Reputation: 15136
I get JSON object with a string field that has 2 values of "yes" or "no".
Is it possible to define a mapping that maps "yes" to "true" and "no" to "false"?
What if the values are not yes/no but two other strings, such as "yep" and "nope"?
Upvotes: 1
Views: 308
Reputation: 17441
Yes for the use case in OP, from documentation :
The boolean type also supports passing the value as a number or a string (in this case 0, an empty string, false, off and no are false, all other values are true).
So "no" would map to false and "yes" would map to true , just need to specify the field to be of type "boolean" in the mapping.
Upvotes: 1