Construct a JSON object from scalar values.
Section: json and string functions
Build JSON in a query
sql
sql
SELECT JSON_OBJECT('id', id, 'email', email) AS user_json FROM users LIMIT 5;Explanation
Helpful for API prototyping, exports, and SQL-side reshaping.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing json and string functions