How do I parse a JSON array response in JScript .NET 4.0? -


i have question parsing json data jscript .net, 4.0. using visual studio 2005 running in windows xp make windows form (as opposed website).

my restful api calls return json data in form of array of objects, example:

[{"country": "usa", "state": "ca", "city": "san francisco”}, {“country”: “usa”, “state”: “wa”, “city”: “seattle”}, {"country": "usa", "state": “ma", "city": “boston”}],  

and don’t know how parse usable object. think need serializer/deserializer, datacontractjsonserializer this, see msdn, having difficulty implementing in jscript .net 4.

i'm not sure if you've moved on this, , need more information help, have collection scripts serve library common things in jscript. 1 common task might make call 1 of these scripts api , json back. in order parse it, went json.org , downloaded json2.js. once got that, i'm able call:

var data = json.parse(string_from_api) 

just in javascript on modern browser. included json2.js in same directory other scripts in library. problem jscript.net (to knowledge) doesn't have json object in modern browsers. have add yourself. once do, can take advantage of json object serialization , deserialization offers.


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -