I am new to C#. I have the following JSON parsed with newtonsoft:
{"Results":{"output1":{"type":"table","value":{"ColumnNames":["Purchased Bike","Scored Labels"],"ColumnTypes":["String","Double"],"Values":[["value","0.55503808930127"]]}}}}
I want to extract the value 0.555... which is under the "Values" level. I was thinking about converting this JSON to a list and then extracting the last element of that:
var pred = results["Results"]["output1"]["value"]["Values"].ToObject<List<"Values">>();
but List
is highlighted as being improper. Note that results
is of type Newtonsoft.Json.Linq.JObject
.
If I try:
var pred = results["Results"]["output1"]["value"]["Values"].ToObject<List<Values>>();
without quotes, Values is highlighted as being a type or namespace that is not found.
How can I cast the "Values" level of my JSON into a list, and then extract the last item?