Convert from JSON object to expando object in c#

satish kumar V picture satish kumar V · Mar 16, 2015 · Viewed 13.2k times · Source

I have a JSON object something like

var jsonObject = {"att1" : "val1","att2" : "val2","att3" : "val3","att4" : "val4"}

I need to convert the same into expandoObject

I tried something like

var expConverter = new ExpandoObjectConverter();
dynamic obj = JsonConvert.DeserializeObject<List<ExpandoObject>>(jsonObject, expConverter);

But It is not giving the result.

Can someone help me to get the result ?

Thanks in advance.

Answer

Ch K V S Kumar picture Ch K V S Kumar · Mar 18, 2015
  dynamic obj = JsonConvert.DeserializeObject<ExpandoObject>(jsonObject, expConverter);

works just fine...