Reputation: 1
In a REST web service, the POST JSON body is like this:
{
"printRequest" : {
"printName" : "XYZ",
"enable" : "truee",
"printerDescription" : "anyString",
"connectionString" : "YYYY",
"ABC" : "XXX"
}
}
Here attribute enable
is of boolean type, but with extra "e" in "true". How do I deserialize it as plain Java boolean?
Upvotes: 0
Views: 1841
Reputation:
JSON supports real booleans:
true
false
Note that there are not quotes. "true"
is not a JSON boolean but a JSON string.
Do yourself a favour and fix the client to send this:
{
"printRequest": {
"printName": "XYZ",
"enable": true,
"printerDescription": "anyString",
"connectionString": "YYYY",
"ABC": "XXX"
}
}
Upvotes: 1