英文:
Are there any new JSONAssert alternatives having compare modes?
问题
我想知道是否有其他类似的库可以替代JSONAssert库,以类似的方式对JSON文件进行断言。这个替代方案应该有类似于JSONCompareMode的功能,比如STRICT和NON_EXTENSIBLE等。JSONAssert库最后的提交似乎很久以前了-> https://github.com/skyscreamer/JSONassert/commits/master,看起来这个项目不再继续开发。
英文:
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.
答案1
得分: 2
这里有一个历史悠久且具有相当全面功能的活跃的 JsonUnit:https://github.com/lukas-krecan/JsonUnit
英文:
There is active JsonUnit with long history and with quite comprehensive features: https://github.com/lukas-krecan/JsonUnit
答案2
得分: 1
ModelAssert具有比较字符串文字、文件和JsonNode
对象中的JSON和YAML的能力。它基于Jackson库:
https://github.com/webcompere/model-assert
assertJson(Paths.get("src", "test", "resources", "simple.json"))
.isEqualTo(Paths.get("src", "test", "resources", "simple-copy.json"));
全面披露 - 我是ModelAssert的作者。
英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论