It's only JSON.parse that has gone native, JSON.stringify is pure
javascript so there is no way to avoid calling into javascript when
you want to stringify an object.  The most efficient approach would
probably be to get a C++ Handle directly to the JSON.stringify
function and then using Function::Call to invoke it with the object
you want to stringify.


-- Christian

On Wed, May 27, 2009 at 5:01 AM,  <[email protected]> wrote:
>
> This would be hugely useful; since I understood JSON parsing had gone
> native I was hoping to find something like this, but digging into the
> headers I didn't find anything like this. It seems the only way I can
> get JSON is to explicitly ask for it in the JS script I'm running with
> a call to return JSON.stringify ... (unless I'm missing something?)
>
> What I actually I need to be able to check the returned v8::Value, eg:
> v->IsArray() or v->IsObject() and THEN decide to get it as a JSON
> string, eg: v->ToJSONString().
>
> What would be the most efficient way to do this with the current code?
> Do I have to turn the v8::Value back into JS and re-execute something?
>
> Regards...
> >
>

--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to