chast chast - 7 months ago 38
JSON Question

C# Json deserialize - property as variable

I have problem. From json: I would like to get property name as variable. Can I do it with Newtonsoft Json library? Thanks in advance for help.


You can deserialize this JSON into a Dictionary<string, decimal> like this:

var prices = JsonConvert.DeserializeObject<Dictionary<string, decimal>>(json);