skyscreamer / JSONassert

Write JSON unit tests in less code. Great for testing REST interfaces.
http://jsonassert.skyscreamer.org
Apache License 2.0
1k stars 197 forks source link

Support very strict ordering where an Object's keys must appear in the same order. #81

Open motlin opened 7 years ago

motlin commented 7 years ago

JSONassert's Objects are org.json.JSONObject, which store the name-value pairs in a HashMap, losing the order of the keys. This matches the json spec, which says that objects are unordered collections of key/values. However, I have tests where I want to make sure that nothing about an api changes, not even the order of keys in objects. I'm looking for something more strict than strict ordering.

This is probably a big change since it means not using org.json.JSONObject, and instead using something where we can configure the Map to be a LinkedHashMap. What do you think? Is that too big of a change for this library?

neuzrui commented 7 years ago

try https://github.com/java-json-tools/json-patch