Registry / testing / json-unit

json-unit

JSON →
library5.1.1javamavenunverified

Library for comparing JSON documents in unit tests with assertions and Hamcrest matchers.

<dependency> <groupId>net.javacrumbs.json-unit</groupId> <artifactId>json-unit</artifactId> <version>5.1.1</version> </dependency>
INSTALL
IMPORT
SIG · JSON-UNIT
J
json-unit
testingjavav5.1.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

JsonAssert
net.javacrumbs.jsonunit.JsonAssert

Asserts that two JSON strings are equal ignoring whitespace and order.

import static net.javacrumbs.jsonunit.JsonAssert.assertJsonEquals; String expected = "{\"name\":\"John\"}"; String actual = "{\"name\":\"John\"}"; assertJsonEquals(expected, actual);
Debug
Known issues
gotchaBy default, JsonUnit ignores array order; use Options.IGNORING_ARRAY_ORDER to control.
fix
Use assertJsonEquals(expected, actual, when(IGNORING_ARRAY_ORDER)) to explicitly set behavior.
affects: all
Upgrade
Version history
5.1.1latest on Maven
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
json-unit — mvn dependency:get json-unit · libregistry