I wonder if there are any alternatives to JSONAssert library which allow asserting a JSON file in a similar way. The Alternative which has a similar feature to JSONCompareMode like STRICT and NON_EXTENSIBLE etc. The last commit in JSONAssert seems to be quite old -> https://github.com/skyscreamer/JSONassert/commits/master and it looks that the project is not developed anymore.
Are there any new JSONAssert alternatives having compare modes?
1.1k Views Asked by vmaaik At
2
There are 2 best solutions below
2

ModelAssert has the ability to compare JSON and YAML from String literals, files and JsonNode
objects. It's based on Jackson:
https://github.com/webcompere/model-assert
assertJson(Paths.get("src", "test", "resources", "simple.json"))
.isEqualTo(Paths.get("src", "test", "resources", "simple-copy.json"));
Full disclosure - I'm the author of ModelAssert
There is active JsonUnit with long history and with quite comprehensive features: https://github.com/lukas-krecan/JsonUnit