title: MySQL flatten Json array to string of values
body: <p>I have a JSON field in mysql for tags like so</p>
  
  <pre><code>[
      {"id": 138001, "tag": "Travel"}, 
      {"id": 138002, "tag": "Holidays"}
  ]
  </code></pre>
  
  <p>and I want to retrieve it as 'Travel Holidays'</p>
  
  <p>I can get the values in the a json array format:</p>
  
  <pre><code>["Travel", "Holidays"]
  </code></pre>
  
  <p>with the current statement,</p>
  
  <pre><code>SELECT JSON_EXTRACT(post_tags, '$[*].tag') AS tags FROM posts WHERE post_id = 646745;
  </code></pre>
  
  <p>but I'm not sure if there is a way to flatten the array into a single string separated by spaces, is it possible?</p>
  
  <p>My reason for doing this, is that sphinx search indexes the tags field also and you can get the id values in the index which isn't desired at all</p>