title: MySQL: JSON to Resultset
body: <p>I have an archive table that has a column which contains unindexed json records. Sample:</p>
  
  <pre><code>[{
      "attr1": "val1",
      "attr2": "val2",
      "attr3": "val3",
      .
      .
      "attrN": "valN"
  }, {
      "attr1": "val1.2",
      "attr2": "val2.2",
      "attr3": "val3.2",
      .
      .
      "attrN": "valN.2"
  },...]
  </code></pre>
  
  <p>I need to create a stored procedure or function that returns the json as a resultset:</p>
  
  <pre><code>  attr1   |   attr2    |   attr3  | ... |  attrN
    _______________________________________________
    val1    |    val2    |   val3   | ... |  valN
    val1.2  |    val2.2  |   val2.2 | ... |  valN.2
  </code></pre>
  
  <p>I need it to return as a recordset as I will be using it for other queries in other stored procedures.</p>
  
  <p>I was able to achieve this with this: <a href="https://stackoverflow.com/questions/46218021/read-json-array-in-mysql/46236573#46236573">Read JSON array in MYSQL</a></p>
  
  <p>However, I was wondering if there is another way besides creating a temporary table? I was thinking about performance and efficiency. Like, what if 20 or 50 users trigger this? Is there a better way to do this?</p>
  
  <p>Note: the avarage size of the json is ~1MB </p>