Closed jansupol closed 6 years ago
Property order is not working globally on the json object. forexample it's not working on map keys
public class Test { private static Jsonb jsonb; @BeforeAll public static void setUp() { JsonbConfig jbConf = new JsonbConfig().withPropertyOrderStrategy(PropertyOrderStrategy.LEXICOGRAPHICAL); jsonb = JsonbBuilder.newBuilder().withConfig(jbConf).build(); } @Test public void propertyOrderTest() { Map<String, String> map = new HashMap<>(); map.put("Alex", "alex@gmail.com"); map.put("Jonas", "enrico@gmail.com"); map.put("Benjamin", "fitz@gmail.com"); map.put("Julie", "Julie@gmail.com"); map.put("Soudeh", "soudeh@gmail.com"); map.put("Pierre", "pierre@gmail.com"); TestProperty prop = new TestProperty(); prop.setMapMail(map); prop.setTime(OffsetDateTime.parse("2014-06-20T00:00:00.000+02:00")); assertEquals( "{\"mapMail\":{\"Alex\":\"alex@gmail.com\",\"Benjamin\":\"fitz@gmail.com\",\"Jonas\":\"enrico@gmail.com\",\"Julie\":\"Julie@gmail.com\",\"Pierre\":\"pierre@gmail.com\",\"Soudeh\":\"soudeh@gmail.com\"},\"time\":\"2014-06-20T00:00+02:00\"}", jsonb.toJson(prop)); }
and the java Bean
class TestProperty { Map<String, String> mapMail; OffsetDateTime time; }
not sure it's a bug.
Property order is not working globally on the json object. forexample it's not working on map keys
and the java Bean
not sure it's a bug.