In this post, we will see how to resolve delete from one object those entries matching another object based off string id
Question:So, given two files with JSON data from the same source type. The JSON objects look something like:
A couple of attempts have been various permutations of the following with accompanying errors:
I’m trying not to have to use a function and I want to accomplish this using
jq. I’m probably not too far off, but I’m at a loss. Any thoughts?
Best Answer:You could compile a list of IDs from the second file using
input, check against it using
IN, and either use
delto delete the matching, or
mapto keep those that do
If you have better answer, please add a comment about this, thank you!