The only legal way is :
if ('undefined' === typeof JSON)
$.getScript("http://www.json.org/json2.js";, proceed );
function proceed ()
{
var obj = JSON.parse(
'[{"carePacks":[{"businessCode":"J1PS","description":"HP
1"}],"coveragePeriod":12},{"carePacks":
[{"businessCode":"J1PS","desc
If the string is in javascript, there are the two ways already
mentioned, though if you built the string in javascript you should
probably just build the json object instead. If the string is in PHP/
JSP/or some other server side language, then just print it out into
the javascipt and save it int
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 jus
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 wro