0

How can i get value from data["v"] using JSON.Net

{
    "event": "ConnectTheDots",
    "data": "{ \"s\":\"wthr\",
           \"u\":\"F\",
           \"l\":\"Jaipur - The Pink City\",
           \"m\":\"Temperature\",
           \"o\":\"Nagarro\",
           \"v\": 3,
           \"d\":\"T" 
         }
    "published_at": "2016-06-08T11:48:32.772Z",
    "coreid": "2b0046000347343138333038",
    "guid": "2b0046000347343138333038",
    "timecreated": "2016-06-08T11:48:32.772Z",
    "location": "",
    "displayname": "",
    "organization": "",
    "value": "",
    "measurename": "",
    "unitofmeasure": "",
    "subject": ""
}
1
  • This JSON is not valid. Try validating it at jsonlint.com Commented Jun 10, 2016 at 14:43

1 Answer 1

1

Deserialize it as a dynamic object. See Deserialize json object into dynamic object using Json.net

dynamic parsed = JObject.Parse(json);
var v = parsed.data.v;  // 3
Sign up to request clarification or add additional context in comments.

3 Comments

i try your code but i'm getting Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create' Application
@PranavPatel You're missing an assembly reference: stackoverflow.com/a/22865030/3191599 Try adding a reference to Microsoft.CSharp.dll.
@PranavPatel Great! If it helped you, mind upvoting? :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.