You _are_ getting back an object from JSON.parse!
Try doing:
print(backToJS.bar);
print(backToJS.baz);
To see that it is actually the real values that it contains.

You will see the exact same behavior if you print foo (i.e., you will
see [object])

Cheers,
Rico

On Tue, Apr 10, 2012 at 7:52 AM, swathi jakkam <[email protected]> wrote:
> Hi,
>
> I have problem with JSON.parser function in v8.How to use the JSON
> methods in V8.Anyone could you tell me the idea about JSON in
> javascript.
>
> Issue: Json.parser() function gives wrong output.
>
> i wrote sample example like below:
>
> var foo = {};
> foo.bar = "new property";
> foo.baz = 3;
>
> var JSONfoo = JSON.stringify(foo);
> print(JSONfoo);
>
> //To make JSONfoo back into a JavaScript object just do:
> var backToJS = json_parse(JSONfoo);
> print(backToJS);
>
> expected result is : {“bar”:”new property”, “baz”:3}          // this
> is for JSONfoo
>                                  {bar:’new property’, baz:
> 3}              // this is for backToJS
>
> But here getting output is wrong
> Coming result is : {“bar”:”new property”, “baz”:3}           // this
> is for JSONfoo
>                                [object
> object]                                   // this is for backToJS
>
> Every time I got [object] message for JSON.parser().
> I don’t known Why this is coming?
>
>
> Regards,
> swathi
>
> --
> 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

Reply via email to