M
mick
Recently started learning Java and android programming and used, for the first
time JSON (in c# I always used XML for web responses). Anyway I thought I'd have
a try to parse JSON in C#. I read about a bit and people seem to be using
JSON.Net so I thought I'd give it a go. Oh dear. The author seems to have chosen
to take a minimalist approach to the docs Plenty of them, just not very
detailed. I've wasted way too many hours trying to work out how to do it but am
no further forward.
Here is the address for a site (which gives cricket scores)
http://pipes.yahoo.com/pipes/pipe.run?_id=tMcVGcqn3BGvsT__2R2EvQ&_render=json
Here is a JSON formatter to make it clear whats going on.
http://jsonformatter.curiousconcept.com/
What I can't fathom is how to get to the "items" array using JSON.net. In
Java/Android it's
easy-
JSONObject result... // (is the JSON response)
JSONObject value= result.getJSONObject("value");
JSONArray array = value.getJSONArray("items");
Here's the doc on json.net array parsing which doesn't help if the array is
nested.
http://james.newtonking.com/json/help/index.html?topic=html/ParseJsonArray.htm
Anyone with any experience with this library give me a clue? Or does anyone know
of a better, less clunky library?
I would have been better off parsing the string myself I think
mick
time JSON (in c# I always used XML for web responses). Anyway I thought I'd have
a try to parse JSON in C#. I read about a bit and people seem to be using
JSON.Net so I thought I'd give it a go. Oh dear. The author seems to have chosen
to take a minimalist approach to the docs Plenty of them, just not very
detailed. I've wasted way too many hours trying to work out how to do it but am
no further forward.
Here is the address for a site (which gives cricket scores)
http://pipes.yahoo.com/pipes/pipe.run?_id=tMcVGcqn3BGvsT__2R2EvQ&_render=json
Here is a JSON formatter to make it clear whats going on.
http://jsonformatter.curiousconcept.com/
What I can't fathom is how to get to the "items" array using JSON.net. In
Java/Android it's
easy-
JSONObject result... // (is the JSON response)
JSONObject value= result.getJSONObject("value");
JSONArray array = value.getJSONArray("items");
Here's the doc on json.net array parsing which doesn't help if the array is
nested.
http://james.newtonking.com/json/help/index.html?topic=html/ParseJsonArray.htm
Anyone with any experience with this library give me a clue? Or does anyone know
of a better, less clunky library?
I would have been better off parsing the string myself I think
mick