title: remove whitespace from postgresql jsonb value
body: <p>For column <code>json_attributes</code>, which holds the key <code>open_dates</code>, I need to update/standardize incoming date formats by stripping off whitespace around the <code>-</code> in the date range. For example, <code>&quot;open_dates&quot;:['01/01 - 12/31']</code> should become <code>&quot;open_dates&quot;:['01/01-12/31']</code>.</p>
  <p>This simple (nonsensical) update works as expected:</p>
  <pre><code>UPDATE table
  SET json_attributes = JSONB_SET(json_attributes, '{open_dates}', '1')
  </code></pre>
  <p>But I'm doing something wrong here, and I'm not sure how to make it right:</p>
  <pre><code>UPDATE table
  SET json_attributes = JSONB_SET(json_attributes, '{open_dates}', (REPLACE('{open_dates}', ' ', '')))
  </code></pre>