Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser changes order of elements alphabeticaly #375

Open
ychyrski opened this issue Apr 13, 2017 · 0 comments
Open

Parser changes order of elements alphabeticaly #375

ychyrski opened this issue Apr 13, 2017 · 0 comments

Comments

@ychyrski
Copy link

ychyrski commented Apr 13, 2017

Code example:

ObjectMapper mapper = JsonFactory.create();
Map<String, Object> input = ImmutableMap.of("s", "1", "d", "2", "a", "3", "f", new String[]{"7", "u", "5"});
String firstJson = mapper.toJson(input);
input = (Map<String, Object>)mapper.fromJson(firstJson);
String secondJson = JsonUtils.toJson(input);
Assert.assertEquals(secondJson, firstJson);

The reason is that internally either HashMap or SortedMap is being used (meaning implementation of <? implements ValueMap>) please consider add LinkingHashMap as a possible holder. Is there another way to prevent sorting?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant