Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.2.10
-
None
-
None
Description
The JSON-B specification unambiguously defines that @JsonbProperty's sole job is to define the name mapping of properites, while ONLY PUBLIC fields are to be actually serialized.
Due to https://issues.apache.org/jira/browse/JOHNZON-100 Johnzon 1.0.9 actually serializes ALL non-public fields when they are annotated by @JsonbProperty.
As a result, there is a difference between the serialized output of Johnzon and Yasson (the RI for JSON-B v1). As discussed in https://github.com/eclipse-ee4j/jsonb-api/issues/271, Johnzon's current behavior is non-compliant to the spec. Also it leads to confusion and possibly real problems when applications RELY on the serialized form intentionally OMITTING such fields (e. g. for technical or security reasons).
To overcome the differences in the serialized output between Johnzon and Yasson, and to have a spec-compliant output produced by Johnzon, a solution is to be found, e. g. introduction of a configuration option which defines whether the output is compliant to the spec (only containing PUBLIC fields), or whether it is like before (containing ALL @JsonbProperty annotated fields).