Comments (2)
If the second one is the expected value, and you use LENIENT or STRICT_ORDER modes, then this will pass. However, if the first one (with age:null) is the expected value, it will fail because technically speaking, the field actually exists in the JSON tree. Therefore, this is WAI. You can try jmayday's advice, or write a scrubber utility to remove null fields before passing it to JSONAssert.
from jsonassert.
When working with some specific class it's possible to annotate it with @JsonInclude(Include.NON_EMPTY) or also prepare own ObjectMapper implementation with Serializers which redefine isEmpty() method to apply even more sophisticated logic. Details described here FasterXML/jackson-databind#730
But it's tricky for me as well to ignore nulls when dealing with raw jsons (then Include strategy nor custom ObjectMapper doesn't do the job).
from jsonassert.
Related Issues (20)
- Release a new version with latest junit dependencies
- Asserting softly
- Don't let the assertion throw a checked exception
- Input not validated to be valid JSON, inconsistent behaviour on certain number values
- Modularization (JPMS)
- False negative when using kotlin raw strings HOT 1
- JSONAssert has undeclared dependency on org.json.JSONArray HOT 1
- NullPointerException at JSONCompareResult.describe
- Customization is failling for nested objects HOT 1
- Provide a "formatted as string" comparison mode
- Customization class inverts the order of expected and actual parameters compared to other parts of the library
- String value equality ignores quotes HOT 1
- Recommend upgrading to the real org.json HOT 9
- make method findUniqueKey in AbstractComparator customizable HOT 1
- Request to add copyright information to pom.xml HOT 1
- Would you consider using the `@Language` annotation for JSON for `JSONAssert.assertEquals`? HOT 2
- Enhancement: Present AssertionError differently HOT 2
- Is it possible to make it case INSENSITIVE HOT 1
- Enhancement: Allow for lazily-constructed messages HOT 2
- [1.5.2] New patch version requires Java 21 HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsonassert.