Using .NET’s DataContractJsonSerializer, I am trying to deserialize a JSON object into a class I defined.
However, the object I’m deserializing has more fields than I need.
Is there a way to make it only deserialize the fields I specified in my corresponding class?
I’m trying to avoid this SerializationException:
The data contract type ‘xxx’ cannot be deserialized because the required data member ‘yyy’ was not found.
This is how I fix most of my JSON errors in .NET. I use JSON.NET instead of the built-in one.
http://json.codeplex.com/
Here’s a quick example shamelessly taken from their docs:
Good luck.