img_url
is not a property of root object – it’s a property of data
object:
var obj = JObject.Parse(json);
var url = (string)obj["data"]["img_url"]; // http://s1.uploads.im/D9Y3z.png
Another option:
var url = (string)obj.SelectToken("data.img_url");
More Related Contents:
- Cannot deserialize the JSON array (e.g. [1,2,3]) into type ‘ ‘ because type requires JSON object (e.g. {“name”:”value”}) to deserialize correctly
- Deserializing JSON to .NET object using Newtonsoft (or LINQ to JSON maybe?)
- Detect if deserialized object is missing a field with the JsonConvert class in Json.NET
- Json.net serialize/deserialize derived types?
- How can I deserialize a child object with dynamic (numeric) key names?
- Deserializing JSON when sometimes array and sometimes object
- Cannot deserialize the current JSON object (e.g. {“name”:”value”}) into type ‘System.Collections.Generic.List`1
- How to ignore JsonProperty(PropertyName = “someName”) when serializing json?
- Json.NET deserialize or serialize json string and map properties to different property names defined at runtime
- Deserializing JSON when key values are unknown
- Deserializing dates with dd/MM/yyyy format using Json.Net
- Deserializing JSON with unknown object names
- How to convert datatable to json string using json.net?
- How do I convert an escaped JSON string within a JSON object?
- JToken: Get raw/original JSON value
- JContainer, JObject, JToken and Linq confusion
- How to convert Json array to list of objects in c#
- Replace part of a JSON with other (using a string token)
- Cannot deserialize the current JSON array (e.g. [1,2,3])
- Repeated serialization and deserialization creates duplicate items
- How do you Add or Update a JProperty Value in a JObject
- Load multiple concatenated JSON objects from stream
- Parsing a JSON array using Json.Net
- Serializing an interface/abstract object using NewtonSoft.JSON
- Best ways to split a string with matching curly braces
- Json.net deserialization null guid case
- Deserialize JSON when a value can be an object or an empty array
- Deserializing JSON into an object with Json.NET
- Ignore Base Class Properties in Json.NET Serialization
- Streaming large list of data as JSON format using Json.net