Subj : Re: Serializing JavaScript in spidermonkey To : netscape.public.mozilla.jseng From : Marcello Bastea-Forte Date : Wed Dec 31 2003 10:54 am Brendan Eich wrote: > Chris Zumbrunn wrote: > >> Brendan Eich wrote: >> >>> In my experience there is no best way, because what hides behind a JS >>> object can't be expressed in a literal form in the JS language, in full. >> >> >> >> Douglas Crockford's JSON wouldn't do the job? >> http://www.crockford.com/JSON/index.html > > > Cool, I hadn't kept up with Douglas's stuff. That will work for object > trees, but not graphs in general, or objects with private data that > cannot be expressed in JS itself (although you could stuff any data into > a string, base64-encoded or whatever, the problem of getting the private > data to serialize itself, and calling an appropriate deserializing ctor > remains, and requires native code extensions). I don't need private data or native object support for my project, but I don't quite understand how JSON applies to what I need other than showing me what the output should look like. How would I programmatically generate that code from a JavaScript object in spidermonkey? That is, is there some built-in method for doing this already? Marcello .