See anything wrong with this JSON2 push/stringify?
dynamictextareas.push({guideid:t开发者_JAVA百科argeteditorID, guideitemtext : textareacontents });
alert( JSON.stringify(dynamictextareas) );
See anything wrong with this JSON2 javascript code?
For some reason this come is making a mess of things. I want to push:
<p>DDDDDD</p>
But instead it's pushing:
[{"guideid":"1","guideitemtext":"<p>\u000a\u0009u000au0009DDDDDD</p>\u000a"}]
Any ideas? Is there a better way I can build this JSON object?
\u000a is identical to \n
(newline) and \u0009 is identical to \t
(tab).
The JSON spec states that newlines and tabs must be escaped, and thats what has happened here.
If you do not want these characters serialized, then you can remove them prior to serializing e.g with a regexp.
精彩评论