title: How to cast value as JSON in MariaDB?
body: <p>I want to extract a JSON with table name and columns inside each table.</p>
  <p>Here is my SQL:</p>
  <pre class="lang-sql prettyprint-override"><code>SELECT
      JSON_OBJECTAGG(table_name, columns)
  FROM (
      SELECT
          table_name,
          JSON_OBJECTAGG(column_name, data_type) as columns
      FROM `COLUMNS`
      WHERE
          `TABLE_SCHEMA` = 'my_db'
      GROUP BY table_name
  ) table_columns
  </code></pre>
  <p>The problem is in <code>JSON_OBJECTAGG(table_name, columns)</code>, columns became string. How to cast it as JSON?</p>