title: Splitting json elements in an array using json_array in mySQL
body: <p>I am trying to retrieve some information from a mySQL database table where i am creating a column of json type. Here i am entering a full json array that consists of individual jsons.</p>
  
  <pre><code>{"Date": "2019-09-30", "TableName": "es_apn_1", "Count": "3"}, {"Date": "2019-09-30", "TableName": "es_response_1", "Count": "297"}, {"Date": "2019-09-30", "TableName": "es_group_1", "Count": "356"}
  </code></pre>
  
  <p>So i am trying to get individual jsons using json_array() and json_object() and then get their respective values.</p>
  
  <p>I have tried entering the json in simply like :</p>
  
  <pre><code>{"Date": "2019-09-30", "TableName": "es_apn_1", "Count": "3"}, {"Date": "2019-09-30", "TableName": "es_response_1", "Count": "297"}, {"Date": "2019-09-30", "TableName": "es_group_1", "Count": "356"}
  </code></pre>
  
  <p>or in an array form like: </p>
  
  <pre><code>[{"Date": "2019-09-30", "TableName": "es_apn_1", "Count": "3"}, {"Date": "2019-09-30", "TableName": "es_response_1", "Count": "297"}, {"Date": "2019-09-30", "TableName": "es_group_1", "Count": "356"}]
  </code></pre>
  
  <p>or in a json:</p>
  
  <pre><code>{{"Date": "2019-09-30", "TableName": "es_apn_1", "Count": "3"}, {"Date": "2019-09-30", "TableName": "es_response_1", "Count": "297"}, {"Date": "2019-09-30", "TableName": "es_group_1", "Count": "356"}}
  </code></pre>
  
  <p>The query that i used to fetch my result is:</p>
  
  <pre><code>select json_object(js,'Date'), json_object(js,'TableName'), json_object(js,'Count') from (select json_array(jsondata) as js);
  </code></pre>
  
  <p>where jsondata is the name of column where the above entries are present.</p>
  
  <p>But i get the result eveytime in this format.</p>
  
  <pre><code>{"[\"{\\\"Date\\\": \\\"2019-09-30\\\", \\\"TableName\\\": \\\"es_apn_1\\\", \\\"Count\\\": \\\"3\\\"}, {\\\"Date\\\": \\\"2019-09-30\\\", \\\"TableName\\\": \\\"es_response_1\\\", \\\"Count\\\": \\\"297\\\"}, {\\\"Date\\\": \\\"2019-09-30\\\", \\\"TableName\\\": \\\"es_group_1\\\", \\\"Count\\\": \\\"356\\\"}\"]": "Date"} | {"[\"{\\\"Date\\\": \\\"2019-09-30\\\", \\\"TableName\\\": \\\"es_apn_1\\\", \\\"Count\\\": \\\"3\\\"}, {\\\"Date\\\": \\\"2019-09-30\\\", \\\"TableName\\\": \\\"es_response_1\\\", \\\"Count\\\": \\\"297\\\"}, {\\\"Date\\\": \\\"2019-09-30\\\", \\\"TableName\\\": \\\"es_group_1\\\", \\\"Count\\\": \\\"356\\\"}\"]": "TableName"} | {"[\"{\\\"Date\\\": \\\"2019-09-30\\\", \\\"TableName\\\": \\\"es_apn_1\\\", \\\"Count\\\": \\\"3\\\"}, {\\\"Date\\\": \\\"2019-09-30\\\", \\\"TableName\\\": \\\"es_response_1\\\", \\\"Count\\\": \\\"297\\\"}, {\\\"Date\\\": \\\"2019-09-30\\\", \\\"TableName\\\": \\\"es_group_1\\\", \\\"Count\\\": \\\"356\\\"}\"]": "Count"}
  </code></pre>
  
  <p>Can you help me with the query or the format in which i should insert my entries to correctly get desired output?</p>