i have a json like this
"[{ "item" : { "id":1 , "name":"abc" } , "item" : { "id":1 , "name":"abc" } ]"
How can i parse the items and save them as Item(a class defined by me) in this json using (Linq) JSON.NET?
i found http://james.newtonking.com/pages/json-net.aspx but i don’t know how to parse list of objects (item) considering in this case there are multiple ‘item’s and each ‘item’ is composed from other data
It’s pretty simple actually:
EDIT #1:
But you asked about converting an array and I missed that. I’m sure it’s still pretty easy to do even if your JSON is an array of those objects. I just wrote up this little example but I’m using a list instead of an array:
EDIT #2:
I made a change to your Json string because it wouldn’t work the way you had it.