Closed impvd closed 3 years ago
To get the semantic you want, you can use transform : string option [@key "transform"] [@yojson.default None]
.
int option
means that you want to accept null
or any integer.@default
gives the default value when the field is missingUsing [@yojson.option]
modifies the behavior of option
. It means
Comment back here if you think your issue is not fully addressed.
As it mentioned in the README
Would match the following examples:
I would like to make it reverse as follows:
Basically it works well in this case, however when I tried to change it from
transform : string option; [@key "transform"]
totransform : string option; [@key "transform"] [@yojson.option]
, there's an error:Just curios if it is not necessary to use
[@yojson.option]
in this case?