Reputation: 33
I have a problem using Boolean wrapper with JSON Object, when JSON object is created for Boolean values it contain string cotes for example "isUrgent" : "1"
Now the issue is I have to wrap it manually in my code each time for each request/response
Can any body please provide me a permanent solution for above problem?
Upvotes: 3
Views: 8146
Reputation: 116472
For what it is worth, boolean type can be converted from alternative JSON tokens (not just native true or false); so that
but in this case you have combination of things, which is not supported.
Upvotes: 2
Reputation: 469
The solution is to customize the deserializer for the boolean type. All you need to do is add extra deserializer which could handle the case of particular String values which you aim to deserialize as the booleans.
Following blog post explains it in detail.
Upvotes: 3