Javascript encoding not valid for JSON -
are encodings json , javascript different? have javascript snippet embedded in json. moment special character present in javascript (e.g. '(' represented \x28 in js snippet) causes json invalid.
in example above, if update '(' represented '(' instead of '\x28' result in valid json. first representation hex. while second valid html. i'm not familiar encoding types.
could me understand encoding need use on javascript in order ensure results in correct format json?
i've included rough example below. special characters '\x28rt' denotes '(rt'. in js gets encoded \x28rt. valid json needs ''rt
{ "class":"mytype", "id":"testid", "javascript":"function testmethod() {var v2 = function (a, b, e) {return e(a, b);};}var v1 = 'somevalue';if (v2((v1), ('\x28rt'), function (a, b) {if (a == undefined || == null) {return false;}return === b;})) {alert('test1');};} else {alert('test2');};}}", "name":"step1" }
\x28
ascii escaping, have tried unicode escaping \u0028
? http://www.json.org/ says char string can have unicode character.
Comments
Post a Comment