[jQuery] Re: Correct way to read JSON string

2008-02-13 Thread Mike Alsup
> > > Also you can check jQuery's source around line 2200 for an interesting > method that does not use eval: It doesn't use eval explicitly, but the server response is eval'd implicitly because it is requested with a script tag.

[jQuery] Re: Correct way to read JSON string

2008-02-13 Thread polyrhythmic
jQuery doesn't include JSON parsing separate from the getJSON, and if you look at the source it's only a couple lines, and designed to work with callbacks. It does not do hardcore JSON sanitizing so you do still need a safe source as always. For one JSON parsing method, see http://mg.to/topics/p

[jQuery] Re: Correct way to read JSON string

2008-02-13 Thread J Moore
This isn't specific to jQuery. One way... var x = '{a:123,b:456}'; // json eval('var z='+x); z is now an object. z.a = 123, etc. -j On Feb 13, 3:47 pm, wolf <[EMAIL PROTECTED]> wrote: > hi, > > what is the correct way in jQuery to decode = deserialize a JSON > string? jQuery itself can obviou

[jQuery] Re: Correct way to read JSON string

2008-02-13 Thread Shawn
one way (but probably not the best) var myobj = eval(myjsonString); I wouldn't trust this though - specially if the json string is from an untrusted source Shawn wolf wrote: hi, what is the correct way in jQuery to decode = deserialize a JSON string? jQuery itself can obviously do it