Open nivesnine opened 3 years ago
Looking for a way to compare current object to another object:
$.objects[1].some_other_thing[?(@.some_field != $.objects[0].some_thing.some_field)]
it would also be nice to be able to compare arrays, if that's at all possible:
$.objects[?(@.some_other_thing != @.some_thing)].some_field
Example where some_field is different:
[ { "objects": [ { "some_thing": { "some_field": 1 } }, { "some_thing": { "some_field": 2 } } ] } ]
Result:
'some_field': 1, 'some_field': 2
Example where some_field is the same:
[ { "objects": [ { "some_thing": { "some_field": 1 } }, { "some_other_thing": { "some_field": 1 } } ] } ]
'some_field': 1,
This may be out of the scope of this project, or it's possible there's already a way to do this. Attempting to try this caused errors around $ and @ in the filter after the !=:
$
@
!=
and
Looking for a way to compare current object to another object:
$.objects[1].some_other_thing[?(@.some_field != $.objects[0].some_thing.some_field)]
it would also be nice to be able to compare arrays, if that's at all possible:
$.objects[?(@.some_other_thing != @.some_thing)].some_field
Example where some_field is different:
[ { "objects": [ { "some_thing": { "some_field": 1 } }, { "some_thing": { "some_field": 2 } } ] } ]
Result:
'some_field': 1, 'some_field': 2
Example where some_field is the same:
[ { "objects": [ { "some_thing": { "some_field": 1 } }, { "some_other_thing": { "some_field": 1 } } ] } ]
Result:
'some_field': 1,
This may be out of the scope of this project, or it's possible there's already a way to do this. Attempting to try this caused errors around
$
and@
in the filter after the!=
:$.objects[1].some_other_thing[?(@.some_field != $.objects[0].some_thing.some_field)]
and
$.objects[?(@.some_other_thing != @.some_thing)].some_field