Parsing "complex" json

Hi all,
I have a json file which have several entries types, how should I parse it?


basically the Extended Data may be different for each entry


Well, one part is the parsing which is kinda trivial with a generic parser. However if you want to represent this data with C# classes it would be tricky. My SimpleJSON parser can parse any valid json and provides easy access to the data. It does not map the data to your own custom classes but just provides the data in the same structure only using the internal node classes. This allows direct access of any data that may be stored in the JSON.

Of course how you treat the different “extended data” sub classes is up to you. If they are specific for each “Type”, you can map the data manually to your own classes. In this case you need to manually create the actual classes depending on the “Type” field. Once that’s done, you could define an interface / abstract class that handles the deserialization (and serialization) for each individual class. I’ve posted several examples over here.