Closed eaaliprantis closed 6 years ago
Hi, the result of serialization is plain javascript, so you don't need to parse and you can do
const data = {a: 1, b: function() { console.log('hi') }}
const stringified = stringify(data)
let back
eval(`back = ${stringified}`)
nb. pay attention to manage the content from injections
Common use is to create a .js
file with "stringified" content and use require
to load it (or at least was what I needed to accomplish when I wrote it)
Thanks for question, I'll add this point in documentation asap
So I was using this library and was trying to parse the extended stringify back to its original format. I haven't really found a parser that would handle it correctly. JSON.parse returns errors because it doesn't understand functions inside the object
Is there a solution to this? Or a different library that works well with your extension for deserializing/decoding/parsing the extended stringify?