Топ-100
 

JSON_OBJECT

База данных: MySQL
Текст

Syntax:
JSON_OBJECT([key, val[, key, val] ...])

Evaluates a (possibly empty) list of key-value pairs and returns a JSON
object containing those pairs. An error occurs if any key name is NULL
or the number of arguments is odd.

URL: https://dev.mysql.com/doc/refman/8.0/en/json-creation-functions.html

Пример

mysql> SELECT JSON_OBJECT('id', 87, 'name', 'carrot');
+-----------------------------------------+
| JSON_OBJECT('id', 87, 'name', 'carrot') |
+-----------------------------------------+
| {"id": 87, "name": "carrot"} |
+-----------------------------------------+