Quantcast
Channel: Active questions tagged jq - Stack Overflow
Viewing all articles
Browse latest Browse all 524

How to Subtract Objects in jq?

$
0
0

We can merge two objects recursively with * operator. For example like this: jq '.[0] * .[1]' -s a.json b.json. The only problem (I realized) with it is it doesn't merge the arrays. But some guys did it.


What I want is the opposite. Assuming the things in b.json are always exist in a.json; a.json, b.json and the result respectively:

{"background": {"service_worker": "js/background.js","type": "module"  },"manifest_version": 3,"permissions": ["storage","unlimitedStorage"  ]}
{"background": {"type": "module"  },"permissions": ["unlimitedStorage"  ]}
{"background": {"service_worker": "js/background.js"  },"manifest_version": 3,"permissions": ["storage"  ]}

There are some questions on Stack Overflow like this but they are specific cases. I rather have a generic one like the meld function.


I tried to edit the meld function but couldn't achieve anything worth to mention.


Viewing all articles
Browse latest Browse all 524

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>