user1841964
user1841964

Reputation: 111

Parsing JSON with Newtonsoft

The problem is that JSON is in the following format:

{"think":{"median":1.24531,"test":6.2342}}

This is how the output of the server looks like, when I try to parse it I get errors because the values aren't inside quotes.

Upvotes: 1

Views: 1725

Answers (1)

L.B
L.B

Reputation: 116108

They are doubles and shouldn't be inside quotes. This works:

var str = @"{""think"":{""median"":1.24531,""test"":6.2342}}";
dynamic dyn = JsonConvert.DeserializeObject(str);
Console.WriteLine((double)dyn.think.median);

Upvotes: 1

Related Questions