I am new to using JSON and JSON.net, and I am having problems with an array of JSON objects in a JSON object. I use JSON.net, as other examples that I saw make it straightforward.
I download the following JSON line from the Internet:
{"count":2,"data":[{"modifydate":12345,"key":"abcdef", "content":"test file 1"},{"modifydate":67891,"key":"ghjikl", "content":"test file 2"}]}
I know that it needs to be deserialized, and for this I need the JSON class that I wrote:
public class NOTE
{
[JsonProperty(PropertyName = "count")]
public int count { get; set; }
[JsonProperty(PropertyName = "key")]
public string key { get; set; }
[JsonProperty(PropertyName = "modifydate")]
public float modifydate { get; set; }
[JsonProperty(PropertyName = "content")]
public string modifydate { get; set; }
}
So I deserialize it using:
NOTE note = JsonConvert.DeserializeObject<NOTE>(e.Result);
This works fine, since I can access the count property and read it in order, but everything in the data property I cannot. It seems to me that this is an array of JSON objects and its problems that I encountered, I would like to get a list of, say, all "key" values ββor all lines of "content".
, , , , , , .
- , :)