Closed jansupol closed 6 years ago
@m0mus Commented Looks like a bug in Yasson. Can you please move it to Yasson issues tracker here https://github.com/eclipse/yasson/issues and we will start working on it.
@readlearncode Commented opps sorry moved to https://github.com/eclipse/yasson/issues/57
Changing the order of the fields in a Java Bean changes the behaviour of
JsonbAdapter
.Given the
JsonbAdapter
:And the Java Bean:
The
adaptToJson()
method is called twice, once for thefirstName
field and again for thelastName
field. Change the order of the fields as follows:and only the
firstName
field is passed to theadaptToJson()
method.Code is here: https://github.com/readlearncode/Java-EE-8-Sampler/tree/master/json-b-1-0/src/main/java/com/readlearncode/devWorks/part2/adaptors
Unit tests here: https://github.com/readlearncode/Java-EE-8-Sampler/tree/master/json-b-1-0/src/test/java/com/readlearncode/devWorks/part2/adapter