chast chast - 2 months ago 9
JSON Question

C# Json deserialize - property as variable

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

Answer

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

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