title: Modify JSON values based on array of keys using jq
body: <p>I need to change the value of a set of keys (defined in a variable) in a JSON object using jq.</p>
  
  <p>As example, I have this JSON object:</p>
  
  <pre><code>{
      foo: {
          bar: 1,
          baz: 2,
          qux: 3
      }
  }
  </code></pre>
  
  <p>and the following variable: </p>
  
  <pre><code>update_keys = ["bar", "baz"]
  </code></pre>
  
  <p>I would like to say 'change the value of the keys in update_keys to X'.</p>
  
  <p>The following works:</p>
  
  <pre><code>.foo = (.foo | 
          to_entries | 
          map(if .key == "bar" or .key == "baz" 
          then . + { "value":"X" } 
          else . 
          end) |
          from_entries)
  </code></pre>
  
  <p>But instead of <code>if .key == "bar" or .key == "baz"</code> I am looking for a way to say <code>if .key in update_keys</code>, or a similar logic.</p>