Any clever ideas/tools for a situation where I'm testing a JSON-returning API, and I don't really care to check each and every field, but just want to check a subset of them? For example, if I decode the response into an array, it might be something like:
array(
'foo' => 'bar',
'something' => 'else',
'data' => array(
'key' => 'test',
'value' => 1234
)
)
If I then had an "expected results" array like so...
array(
'foo' => 'bar'
'data' => array(
'value' => 1234
)
)
...can you imagine a way to compare the expected result array to the superset of the full result array?
The idea here is to end up with something generic that I can feed two arrays (or JSON strings) of arbitrary size/depth, and just verify if the fields of interest in the expected results are in the actual results (with the expected values).