C
C#3mo ago
nedved

How to deserialize JSON like a normal person

How does one deserialize big nested json without making ton of wrapper classes or whatever. Or where do I put these classes to not make a mess in my project?
3 Replies
Jimmacle
Jimmacle3mo ago
what kind of wrapper classes? writing models that match the shape of the json is the recommended practice
Pobiega
Pobiega3mo ago
and you only need to write models for the parts you care about. if an object has 40 props but you only care about one of them, you only model that one prop
Yawnder
Yawnder3mo ago
You basically got two choices: Make the classes for the things you want deserialized, or load it into JTokens and suffer.