title: How to update a SQL column that has key-value pairs?
body: <p>I have a SQL column called <code>pairs</code> that consists of key value pairs like this:</p>
  
  <pre><code>{"fr":"true","it":"false","lastValue":"false"}
  </code></pre>
  
  <p>I want to update <code>lastValue</code> to true. If <code>lastValue</code> doesn't exist, I want to add it to the column. I saw the concat function which lets me append it to the column like this:</p>
  
  <pre><code>set pairs = concat(substring(pairs, 1, char_length(pairs) - 1), ',"lastValue":"', 'true',"'}')
  </code></pre>
  
  <p>But if the value already exists, I want to update the existing value. If it doesn't exist, I want to concatenate it. Is there a way to do that in SQL?</p>