title: PostgreSQL: array in text to array
body: <p>I have JSON array in <code>text</code> type field in DB, and I want to check whether there are some elements in the array, and in that case, add some elements to this array and save it back to DB. The main issue I am having is that this text field looks like this:</p>
  
  <pre><code>["elem1","elem2","elem3"]
  </code></pre>
  
  <p>and I cannot figure out how to work with those double-quotes.</p>
  
  <p>When I tried <code>to_json</code> it resulted in:</p>
  
  <pre><code>"[\"elem1\",\"elem2\",\"elem3\"]"
  </code></pre>
  
  <p>When I tried <code>string_to_array</code>:</p>
  
  <pre><code>{"[\"elem1\"","\"elem2\"","\"elem3\"]"}
  </code></pre>
  
  <p>I just need something like that:</p>
  
  <pre><code>['elem1', 'elem2', 'elem3']
  </code></pre>