Feature Request - Ignore missing properties

Apr 7, 2008 at 5:54 PM
Basically, I'd like to see an option where I can tell it, during deserialization, to ignore missing properties. Line 415 in JsonSerializer.cs in the latest version (I believe) where it says:

if (_missingMemberHandling == MissingMemberHandling.Error)

it then throws an error. I'd like the fact that it throws an error to be optional. I'm going to probably hack this into a copy of the source for my own use, but it will be quick and dirty (like maybe just commenting out the throw) and there is probably a much better way to do it.

Thanks!
Apr 7, 2008 at 5:58 PM
Duh, I'm an idiot - it's right there in front of my face in that statement I posted. Ignore me. I just need to figure out how to set that property.
Apr 7, 2008 at 6:22 PM
Ok, change this Feature Request into a suggestion :)

Add in a property on the JsonObjectAttribute to optionally pass in the missingmemberhandling just like you added for the Memberserialization property. I did this in my copy of the code and it works just fine. I don't exactly know how the patches work on CodePlex as I've never contributed before, but if you want my very small changes to add this in, let me know.

Coordinator
Apr 9, 2008 at 12:02 PM
Good idea. A lot of the options on JsonSerializer could also be added to JsonObjectAttribute.
I want to get 2.0 released so this will probably wait until 2.1.
Apr 18, 2008 at 2:36 PM
Also please include NullValueHandling in the JsonObjectAttribute. Again, I have code if you want it. Would probably take me longer to cut and paste it into an email though that it would for you to add it. :)