You can retrieve a JSON representation of a table by using the
DESCRIBE AS JSON TABLE
statement:
DESCRIBE AS JSON TABLE table_name [(field-name, field-name2, ...)]
or
DESC AS JSON TABLE table_name [(field-name, field-name2, ...)]
where:
table_name is the name of the table you want to describe.
field-name is 0 or more fields defined for the table that you want described. If specified, the output is limited to just the fields listed here.
Map and Array fields support the use of ELEMENTOF() to restrict the JSON representation to just the map or array element.