0

I have to deserialize a json with json.net

Json data like:

enter image description here

The green blocks' property name(key) was fixed,

but the others were dynamic and the quantity of them not fixed.

How to i declare my class to deserialize the data

use JsonConvert.DeserializeObject(jsonString)

or other best solution?

Max
  • 4,439
  • 2
  • 18
  • 32
  • Maybe a custom `ContractResolver` might help? – ProgrammingLlama Dec 15 '17 at 01:26
  • You'll need to serialize it into a `Dictionary` if you don't know the keys. – Rob Dec 15 '17 at 01:28
  • Sounds like your objects have a fixed schema + additional variable properties. If so, see [How to serialize a Dictionary as part of its parent object using Json.Net](https://stackoverflow.com/q/14893614) and also [Deserialize json with known and unknown fields](https://stackoverflow.com/q/15253875). – dbc Dec 15 '17 at 03:06

0 Answers0