title: subtracting one json file from another in jq
body: <p>Is there a way to compare two json files in jq? Specifically, I'd like to be able to remove objects from one json file if they occur in another json file. Basically, subtract one file from another. It would be a bonus if I could generalize this so that I could define the equality criteria for the objects, but this is not strictly necessary, it can be based strictly on the objects being identical. </p>
  
  <p>So the more general case would look like this. Let's say I have a file that looks like this:</p>
  
  <pre><code>[
    {
      "name": "Cynthia",
      "surname": "Craig",
      "isActive": true,
      "balance": "$2,426.88"
    },
    {
      "name": "Elise",
      "surname": "Long",
      "isActive": false,
      "balance": "$1,892.72"
    },
    {
      "name": "Hyde",
      "surname": "Adkins",
      "isActive": true,
      "balance": "$1,769.34"
    },
    {
      "name": "Matthews",
      "surname": "Jefferson",
      "isActive": true,
      "balance": "$1,991.42"
    },
    {
      "name": "Kris",
      "surname": "Norris",
      "isActive": false,
      "balance": "$2,137.11"
    }
  ]
  </code></pre>
  
  <p>And I have a second file that looks like this:</p>
  
  <pre><code>[
    {
      "name": "Cynthia",
      "surname": "Craig"
    },
    {
      "name": "Kris",
      "surname": "Norris"
    }
  ] 
  </code></pre>
  
  <p>I'd like to remove any objects from the first file where the name and surname fields match an object of the second file, so that the results should look like this:</p>
  
  <pre><code>[
    {
      "name": "Elise",
      "surname": "Long",
      "isActive": false,
      "balance": "$1,892.72"
    },
    {
      "name": "Hyde",
      "surname": "Adkins",
      "isActive": true,
      "balance": "$1,769.34"
    },
    {
      "name": "Matthews",
      "surname": "Jefferson",
      "isActive": true,
      "balance": "$1,991.42"
    }
  ] 
  </code></pre>