How about the obvious? Run a script that calls JSON.stringify() on the object/string and returns it. Everything I've seen is that doing the JSON decode in JavaScript context is fastest.
On Jun 9, 2012, at 8:28 PM, Chris Jimison wrote: > Responses bellow: > > On Sat, Jun 9, 2012 at 4:52 PM, Stephan Beal <[email protected]> wrote: >> On Sun, Jun 10, 2012 at 12:56 AM, Chris Jimison <[email protected]> wrote: >>> >>> Handle<Object> result; >>> if (sourceFlatten->IsSeqAsciiString()) { >>> result = JsonParser<true>::Parse(sourceFlatten); >>> } else { >>> result = JsonParser<false>::Parse(sourceFlatten); >>> } >>> return result; >>> } >> >> >> i don't think that code accepts Array input. > > It was just a quick bit of code I pulled out of runtime.cc and meant > more to inform :) > >> >> Why not just get the "JSON" property from the global scope, Cast() it to an >> Object, get it's "parse" property, cast it to a Function, and Call() that? > > Simplicity always beats complexity, so forget what I suggested. This > is an even better solution. > >> >> -- >> ----- stephan beal >> http://wanderinghorse.net/home/stephan/ >> http://gplus.to/sgbeal >> >> -- >> v8-users mailing list >> [email protected] >> http://groups.google.com/group/v8-users > > -- > v8-users mailing list > [email protected] > http://groups.google.com/group/v8-users -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
