objectmatcher
Service icon

ObjectMatcher

Stable version 1.3.0 (Compatible with OutSystems 11)
Uploaded
 on 13 Jan (17 hours ago)
 by 
5.0
 (1 rating)
objectmatcher

ObjectMatcher

Details
Extension to match two objects, using partial equality
Read more

Extension to match two objects, using partial equality.

For example, an object with the following properties:

{
"A": 123,
"B": "some value"
"C":[ 100, 200, 300]
}

Will match the following objects, because any non-default values are equal:

{   "A": 123  } or  {   "B": "some value"  } or { "C":[ 100, 200, 300] }

Whereas it will NOT match these objects, because they have fields that don't match:

{   "A": 456  } or  {   "B": "some other value"  } or { "C":[ 100, 200, 300, 400] } or { D: 123 }

This code is very useful in Testing, where we want to compare an actual and an expected result, but only on some attributes, not all.

Release notes (1.3.0)
  • Updated MatchJSON implementation so that JSON only matches MatchJSON if it contains all (non-default) properties of MatchJSON. So all properties of MatchJSON should have a matching value in JSON.
License (1.3.0)
Reviews (0)
Team
Other assets in this category