Tin Can
Tin Can

Reputation: 2870

How should a complex Json response be decoded?

I'm working on decoding a json response that's pretty complicated. I've been using Newtonsoft's JsonConvert.DeserializeObject<RootObject>(), but the class I've been deserializing to, RootObject, is getting massive. There are tons of sub-classes (seriously, like 35), and a half-dozen different uses of the sub-class "item." I've been trying to accommodate all of the possible responses using json2csharp and sample responses. I'm also trying to stick with simple, reusable methods, so I don't need to have a different DeserializeObject call for each type of response.

Thanks!

Upvotes: 0

Views: 165

Answers (1)

L.B
L.B

Reputation: 116178

You can make use of dynamic instead of deserializing to some complex object. See Looking for a REST with JSON client library

Upvotes: 1

Related Questions