https://github.com/hertzsprung/hamcrest-json
Hamcrest matchers for comparing JSON documents
https://github.com/hertzsprung/hamcrest-json
Last synced: 9 days ago
JSON representation
Hamcrest matchers for comparing JSON documents
- Host: GitHub
- URL: https://github.com/hertzsprung/hamcrest-json
- Owner: hertzsprung
- License: mit
- Created: 2012-08-18T18:13:40.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2023-09-25T05:31:55.000Z (over 1 year ago)
- Last Synced: 2025-03-30T00:08:23.478Z (16 days ago)
- Language: Java
- Homepage: http://www.datumedge.co.uk/hamcrest-json/
- Size: 88.9 KB
- Stars: 118
- Watchers: 9
- Forks: 21
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: NEWS.md
- License: LICENSE
Awesome Lists containing this project
- awesome-java - Hamcrest-JSON
README
Hamcrest matchers for comparing JSON documents, backed by the [JSONassert library](https://github.com/skyscreamer/JSONassert). The code is released under the [MIT license](http://www.opensource.org/licenses/mit-license.php).
Supports Java 8 or later.Installation
============To install from Maven Central:
```xml
uk.co.datumedge
hamcrest-json
0.2```
Usage
=====
```java
import static uk.co.datumedge.hamcrest.json.SameJSONAs.*;assertThat(
"{\"age\":43, \"friend_ids\":[16, 52, 23]}",
sameJSONAs("{\"friend_ids\":[52, 23, 16]}")
.allowingExtraUnexpectedFields()
.allowingAnyArrayOrdering());
```Resources
=========
* [hamcrest-json website](https://www.datumedge.co.uk/hamcrest-json/)
* [API documentation](https://www.datumedge.co.uk/hamcrest-json/apidocs/index.html)