How to deserialize JSON to an exsited object instance?

Jan 13, 2010 at 8:42 AM

An example looks be:

 

Person p = new Person();

p.Name = "Name";

p.Age = 30;

p.Weight = 60;

string json = "{\"Name\":\"NewName\", \"Age\":31}";

DeserializeTo(json, p);

//p.Name is NewName and p.Age is 31 now, p.Weight is 60 still.

 

thanks.

Coordinator
Jan 16, 2010 at 6:35 AM

JsonConvert.PopulateObject

Jan 18, 2010 at 8:15 AM

Thanks.