title: Use jq to replace array values from dictionary
body: <p>I have a dictionary which looks like:</p>
  
  <pre><code>cat dictionary.json
  [
    {
      "key": "key01",
      "value": "value01"
    },
    {
      "key": "key02",
      "value": "value02"
    },
    {
      "key": "key03",
      "value": "value03",
      "extraProperty": {
        "foo": "bar"
      }
    },
    {
      "key": "key04",
      "value": "value04"
    }
  ]
  </code></pre>
  
  <p>Then, I have an array which is:</p>
  
  <pre><code>echo $array
  key01 key02 key03
  </code></pre>
  
  <p>Expected output:</p>
  
  <pre><code>value01 value02 value03
  </code></pre>
  
  <p>I have some trouble to make jq using an array which is not json format.
  I tried various solutions that I found, but none of them worked.
  This post <a href="https://stackoverflow.com/questions/34878915/jq-how-to-select-objects-based-on-a-whitelist-of-property-values">jq - How to select objects based on a &#39;whitelist&#39; of property values</a> seems to solve a similar problem but it doesn't work with my input:</p>
  
  <pre><code>echo $array | jq --argfile whitelist dictionary.json 'select(any(.key== $whitelist[]; .value))'
  parse error: Invalid numeric literal at line 1, column 6
  </code></pre>
  
  <p>I also tried to use</p>
  
  <pre><code>jq -n --arg array $array --argfile whitelist dico.json 'select(any(.key== $whitelist[]; .valuee))'
  jq: error: key02/0 is not defined at &lt;top-level&gt;, line 1:
  key02
  jq: 1 compile error
  </code></pre>
  
  <p>Thanks!</p>