title: Value map with JQ
body: <p>I've a large JSON file where I'd like to transform some values based on some kind of mapping.</p>
  
  <p>The data I have looks like:</p>
  
  <pre><code>[
      {"id":1, "value":"yes"},
      {"id":2, "value":"no"},
      {"id":3, "value":"maybe"}
  ]
  </code></pre>
  
  <p>And I'd like to transform that into a list like this:</p>
  
  <pre><code>[
      {"id":1, "value":"10"},
      {"id":2, "value":"0"},
      {"id":3, "value":"5"}
  ]
  </code></pre>
  
  <p>With the fixed mapping:</p>
  
  <pre><code>yes =&gt; 10
  no =&gt; 0
  maybe =&gt; 5
  </code></pre>
  
  <p>My current solution is based on a simple <code>if-elif-else</code> combination like this:</p>
  
  <pre><code>cat data.json| jq '.data[] | .value = (if .value == "yes" then "10" elif .value == "maybe" then "5"  else "0" end)'
  </code></pre>
  
  <p>But this is really ugly and I'd love to have a more direct way to express the mapping.</p>
  
  <p>Thanks for your help</p>