Deserialize array of JSON objects to c# anonymous -


this question has answer here:

any ideas how achieve this? have no problem deserializing single json object c# anonymous type

 string json = @"{'name':'mike'}"; 

to

 var definition = new { name = ""}; 

with

var result = jsonconvert.deserializeanonymoustype(json, definition); 

but when have

string jsonarray = @"[{'name':'mike'}, {'name':'ben'}, {'name':'razvigor'}]"; 

i stuck. thanks!

you can deserialize dynamic object this.

dynamic result = jsonconvert.deserializeobject(jsonarray); 

Comments

Popular posts from this blog

sql - Time in datatime field -

javascript - How to split the success output from an Ajax post? -

java - sharing object across different classes -