You could also use:

var myobj = (new Function("return " + JSONString))()

http://yuiblog.com/blog/2006/11/13/javascript-we-hardly-new-ya/#comment-15107

On Mon, Apr 27, 2009 at 2:30 PM, Remon Oldenbeuving <
r.s.oldenbeuv...@gmail.com> wrote:

> If your completly sure that it is save, you could just use eval:
>
> eval("var myJSON = [{"carePacks": [{"businessCode":"J1PS","description":"HP
> 1"}],"coveragePeriod":12},{"carePacks":[{"businessCode":"J1PS","description":"HP
> s"}],"coveragePeriod":13}];");
>
> On Mon, Apr 27, 2009 at 10:13 AM, gaohk <cnga...@gmail.com> wrote:
>
>>
>> I have a string that is like [{"carePacks":
>> [{"businessCode":"J1PS","description":"HP 1"}],"coveragePeriod":12},
>> {"carePacks":[{"businessCode":"J1PS","description":"HP
>> s"}],"coveragePeriod":13}].
>> can you give me some advice on how to convert it to a json structure,
>> and how to get data from the data structure, like get "HP 1".
>>
>> >>
>>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to