I have a large json dataset that I need to deserialize. I am using Json.net JsonTextReader to read data.
My problem is that I need to deserialize some derived classes, so I need to be able to "look ahead" for a specific property that defines my data type. In the example below, the "type" parameter is used to determine the type of object to deserialize.
{ type: "groupData", groupParam: "groupValue1", nestedObject: { type: "groupData", groupParam: "groupValue2", nestedObject: { type: "bigData", arrayData: [ ... ] } }
My derived objects can be very nested and very deep. Loading the entire data set into memory is undesirable since it will require a lot of memory. When I move to the "bigData" object, I will process the data (for example, the array in the example above), but it will not be stored in memory (it is too large).
All the solutions to my problem that I have seen so far have used JObject to deserialize partial objects. I want to avoid using JObject because it will deserialize each object in the hierarchy again.
How can I solve the problem of deserialization?
Is there a way to search by the "type" parameter, and then return to the beginning of the object {symbol to start processing?
Matt houser
source share