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.
Asked
Active
Viewed 827 times
2 Answers
2
There is active JsonUnit with long history and with quite comprehensive features: https://github.com/lukas-krecan/JsonUnit

sasynkamil
- 859
- 2
- 12
- 23
1
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

Ashley Frieze
- 4,993
- 2
- 29
- 23
-
Looks good - exactly what I’ve been looking for. Left you a GitHub issue re SLF4J – mactwixs Jun 23 '21 at 17:25
-
https://github.com/webcompere/model-assert/issues/38 - is the issue in question. Looks like something else has dependencies on Jackson and hasn't brought in the exact dependencies it needs. – Ashley Frieze Jun 24 '21 at 16:23