You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I comparing them, I want to compare them ignoring the match by the "id" field.
Then
Then comparison fails since JSONAssert tries to 'guess' the key, build map of objects based on the key, and then compare all the keys first.
Keys are guessed in JSONCompareUtil.isUsableAsUniqueKey. The map is built and compared in AbstractComparator.compareJSONArrayOfJsonObjects: for (Object id : expectedValueMap.keySet()) { if (!actualValueMap.containsKey(id)) { result.missing(formatUniqueKey(key, uniqueKey, id), expectedValueMap.get(id));
Expected
To be able to 'customize' the assertion of such unnamed arrays e.g. by ignoring the fields that are able to be a key.
The text was updated successfully, but these errors were encountered:
JSONAssert v1.5.0
Given
I have JSONs with unnamed arrays inside with differences in autogenerated id field:
___actual:
[ { "id": 9901, "value": "foo" }, { "id": 9902, "value": "bar" } ]
expected:
[ { "id": 1, "value": "foo" }, { "id": 2, "value": "bar" } ]
When
I comparing them, I want to compare them ignoring the match by the "id" field.
Then
Then comparison fails since JSONAssert tries to 'guess' the key, build map of objects based on the key, and then compare all the keys first.
Keys are guessed in
JSONCompareUtil.isUsableAsUniqueKey
. The map is built and compared inAbstractComparator.compareJSONArrayOfJsonObjects
:for (Object id : expectedValueMap.keySet()) { if (!actualValueMap.containsKey(id)) { result.missing(formatUniqueKey(key, uniqueKey, id), expectedValueMap.get(id));
Expected
To be able to 'customize' the assertion of such unnamed arrays e.g. by ignoring the fields that are able to be a key.
The text was updated successfully, but these errors were encountered: