Re: PropertyOrderStrategy does not when POJO uses @JsonbProperty

Mark Struberg
 

The problem is that Class#getDeclaredMethods() and Class#geDeclaredtFields() does _not_ return the fields in the order you have them in your program.
The JVM simply does not know about it anymore. In old Java versions it was ordered in the same way as in your code, but I think this got changed in Java7 or so and it's now random.

LieGrue,
strub

Am 27.07.2018 um 23:18 schrieb Jocafi <@jocafi>:

Ok. I read the documentation and you are right.

However, I would like to suggest the creation of a new strategy called PropertyOrderStrategy.PRESERVED OR PropertyOrderStrategy.SLOW_BUT_PRESERVED

The main intention to preserve the order is to speed up the web application development. I do not want to lost time looking where is my ID among the other 50 fields in the json object. I want to see the ID in the first position.

When we go PROD we control the JsonbConfig to use PropertyOrderStrategy.ANY or other strategy in order to win in performance.

I think there are some cases where developers prefer / decide to have less performance and more control about a formatted output. They are minority, but they should also have more control about the generated json format by jsonb.

Best Regards,
Jocafi



Join jsonb-spec@javaee.groups.io to automatically receive all group messages.