Reputation: 243
There is the following data structure (list of dicts):
[
{
"name": "foo",
"value": "value1",
"default": "value1"
},
{
"name": "bar",
"value": "blafasel",
"default": "value2"
}
]
We are now looking for a jq
filter to get all dicts where value
and default
are not equal.
Upvotes: 0
Views: 2851
Reputation: 241868
Iterate over the dicts by .[]
, select only those that have the value different to the default:
jq '.[] | select (.value != .default)' file.json
Upvotes: 2