I have a question to this prototype function:

  function isJSON() {
    var str = this;
    if (str.blank()) return false;
    str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');
    return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);

If I send a JSON { 'str': '<p>This is a line with \n linefeed</p>' } I do get 
an error. The same is, if the JSON is encoded to { 'str': '<p>This is a line 
with %0A linefeed</p>' }.
I need to delete the linefeed or I need to replace to '<br />'.

I do not understand the regular expression above, because I want avoid to use 
other chars, which results in errors.



You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to