How to stringify the system object of javascript? (cf) Event Object, DOM Object
JSON.stringify
does not fully stringify the object.
I wanna stringify it and load to object from the stringified string.
How to stringify the system object of javascript? (cf) Event Object, DOM Object
JSON.stringify
does not fully stringify the object.
I wanna stringify it and load to object from the stringified string.
JSONML is one library which can leverage the output what you're looking for.
For eg,
The below DOM snippet,
<ul>
<li style="color:red">First Item</li>
<li title="Some hover text." style="color:green">
Second Item
</li>
<li><span class="code-example-third">Third</span>Item</li>
</ul>
will be converted as,
[
"ul",
[
"li",
{
"style": "color:red"
},
"First Item"
],
[
"li",
{
"title": "Some hover text.",
"style": "color:green"
},
"Second Item"
],
[
"li",
[
"span",
{
"class": "code-example-third"
},
"Third"
],
" Item"
]
]