I have a snippet of JSON that looks like this:
{"123":{"name":"test","info":"abc"}}
The 123
is an ID and can change on each request. This is beyond my control.
I want to Deserialize the JSON using JSON.NET. I have tried:
User u = JsonConvert.DeserializeObject<User>(json);
However, this does not work unless I define the JsonProperty
attribute like so:
[JsonProperty("123")]
public string ID { get; set; }
But of course I cannot actually do this because the ID 123
will change on every request.
How can I read the ID property using JSON.NET and apply it to the ID class?