icubilla / jsonexserializer

Automatically exported from code.google.com/p/jsonexserializer
0 stars 0 forks source link

Possible to ignore errors for missing properties? #54

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Serialize some json that defines properties that don't exist in the 
destination class.
2.
3.

What is the expected output? What do you see instead?
I'd like to have an option to just simply ignore these properties.

What version of the product are you using? On what operating system?
latest

Please provide any additional information below.

I'm working with Twitter's Stream API and I (a) don't want to create a 
class that defines all properties Twitter defines or (b) have my code break 
should Twitter ever include a new property that I didn't account for with 
explicit ignores.

I'm getting the exception "Could not find property truncated for type 
test.Tweet", because I didn't define a property called "truncated".  It 
seems like jsonexserializer should behave like .NET's xmlserializer and 
simply ignore unknown fields (or at least allow me the option to ignore 
unknown fields).

Original issue reported on code.google.com by lang...@gmail.com on 2 Mar 2010 at 9:53

GoogleCodeExporter commented 9 years ago
That would be a good feature to have.  I will add a MissingPropertyAction that 
you 
can set to Ignore.

Serializer s = new Serializer(typeof(MyClass));
s.Config.MissingPropertyAction = MissingPropertyOptions.Ignore;

I'm leaning toward just making ignore the default.

Which version are you using?

Original comment by elliott....@gmail.com on 2 Mar 2010 at 10:05

GoogleCodeExporter commented 9 years ago
Note: I've chosen not to make this a boolean property because I actually want 
to expand 
it later on to allow you an option to inspect the property and decide the 
action for 
yourself.

Original comment by elliott....@gmail.com on 2 Mar 2010 at 10:08

GoogleCodeExporter commented 9 years ago
The featured+stable release... v3.0.25.205, sounds like a great solution!

Original comment by lang...@gmail.com on 3 Mar 2010 at 1:44

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r267.

Original comment by elliott....@gmail.com on 16 Apr 2010 at 2:57

GoogleCodeExporter commented 9 years ago
Release 3.1

Original comment by elliott....@gmail.com on 16 Apr 2010 at 3:51