Enums are serialized differently with 4.15.0
ai212983 opened this issue · comments
Phase.ACTIVE
would serialize to
- before 4.15.0:
"phase":{"name":"ACTIVE"}
- with 4.15.0:
"phase":"ACTIVE"
Can we have please at least mentioned this in changelog or/and some guidance on how to preserve old behaviour?
The changelog.md file has been updated to include the comment below for 4.15.0.
This version writes Enums in a more compact way with the field name associated to a JSON String name of the enum. However, the prior versions of json-io wrote Enums out as JSON objects. The JSON reader will read Enums either way. If you want the output to continue to write Enums as a JSON Object, use the .writeEnumsAsOptions() on the WriteOptionsBuilder, and it will output enums as it used to.
@jdereg Awesome, thank you!
Small correction though - there's no .writeEnumsAsOptions()
method in WriteOptionsBuilder
, but .writeEnumsAsObjects
.
Thank you for catching this. Corrected.