Handling Nullable parameter
bluemax75 opened this issue · comments
Is there a way of handling a parameter that may be null?
To support a JSON that may come as:
{ "key": 2 }
or as
{ "key": null }
I already tried using Option this way:
type
Test = object
key: Option[int]
This works for the first JSON but the second one gives the following error
Error: unhandled exception: Number expected. At offset: 6 [JsonError]
Thank you for the bug report! I was just missing a space checking before the null
. So the space before the null caused this error.
Wow! That was quick.
Upgraded to 1.0.1 and Option is working perfect. Thank you!