boonproject / boon

Simple opinionated Java for the novice to expert level Java Programmer. Low Ceremony. High Productivity.
http://richardhightower.github.io/site/Boon/Welcome.html
Apache License 2.0
522 stars 102 forks source link

toJson(readValue) does not return expected value #384

Closed rzorzorzo closed 5 years ago

rzorzorzo commented 5 years ago

String json1 = "{\"1\":{\"2\":[\"3\"]}}"; System.out.println(json1); ObjectMapper mapper = ObjectMapperFactory.create(); Map map = mapper.readValue(json1.getBytes(), Map.class); System.out.println(map); String json2 = mapper.toJson(map); System.out.println(json2);

outputs:

{"1":{"2":["3"]}} {1={2=[3]}} {"map":{"1":{"map":{"2":{"list":["3"],"lazyChop":true,"converted":true,"MAX_ARRAY_SIZE":1}},"lazyChop":true}},"lazyChop":true}`

why not ?

{"1":{"2":["3"]}}

Further :

mapper.readValue(json1.getBytes(), HashMap.class);

returns an empty map.

I have searched this for some hours now, but could not find anything in the docs.

rzorzorzo commented 5 years ago

PS: I was using release 0.7 instead of the newest one.