Newtonsoft.Json.Linq.JValue Cannot convert method group Value to non-delegate type object Edit

Murugan Andezuthu Dharmaratnam | 11 March 2021 | 3

Problem Statement

I am trying to deserialize the below JSON

{"result":[["test",0.4651161545800183],["hello",0.4651161545800183],["world",0.06976769083996354]]}

using this code

var response2 = JObject.Parse(jsonString);

When I try to parse the dynamic json object to string using the code below

string value = response2["result"][0].Value

I get the this error message

response2["result"][0].Value error CS0428: Cannot convert method group 'Value' to non-delegate type 'object'. Did you intend to invoke the method?

Solution

var keyword = ((Newtonsoft.Json.Linq.JValue)item[0]).Value            
                    

keyword "test" object {string}