New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore element and child element order #231
Comments
Hi, you can take a look at DifferenceListener. |
Could you help me take a look at: It seems not work for me, maybe I'm wrong at configuration. I'm trying to ignore some attribute like 'timestamp' within the object in array, but I still need to check whether 'title' is same. |
No lucky, and this is the config I used:
source:
|
Can you please specify what you are trying to do, what do you expect to happen and what happens instead (as described in the issue template which you apparently ignored). |
If you check my test case, you will find the test case failed for Take above json as example, I'd like to:
|
btw, this works if the 'timestamp' in the root level: But I'm no lucky to ignore it when it's in node of an array. |
If I remember it correctly, the dot in |
Ah... my fault, this one works: commonConfig().when(path("items[*].timestamp"), thenIgnore()).when(path("items"), then(Option.IGNORING_ARRAY_ORDER)); Thanks a lot !! |
I'm wondering whether JsonUnit can meeting my requirement:
https://stackoverflow.com/questions/62277192/how-to-compare-2-json-by-ignoring-some-attributes-and-child-element-orders
By roughly go thru document, I found IGNORING_ARRAY_ORDER and IGNORING_VALUES might help in my case.
Yet I'm not sure whether I can get a "difference list" after applied those rules, rather than assertEquals.
The text was updated successfully, but these errors were encountered: