jquery - Get value from JSON string -
i have following json string:
{"d":"{\"foo\":7,\"bar\":5,\"foobar\":3}"}
and corresponding invocation in js file:
$.getjson("foo.svc/getsomefoo", function (response) { alert(response["foo"]); alert(response["bar"]); alert(response["foobar"]); });
just trying write out values, can't seem out. simple, not finding helpful while googling it.
your json has embedded json. need do:
var d = json.parse(response.d); alert(d.foo); ...
Comments
Post a Comment