Sample Header Ad - 728x90

MySQL: Return JSON from a standard SQL Query

25 votes
6 answers
140359 views
I have read about JSON objects and the JSON object type. I only want to do a select and it return JSON. I do not necessarily want to store a JSON object. Serialization per se it not my question. The columns are regular Varchar, Int, etc. columns, no JSON Objects, "normal" database rows. Can I do a regular old SELECT and return JSON for MySQL? Isn't this what FOR JSON in SQL SERVER and rows_for_json do in PostgreSQL? They seemed ahead in this are but I didn't want to fool myself. I found this question from 2016: https://stackoverflow.com/questions/35324795/mysql-5-7-return-row-as-json-using-new-json-features
Asked by johnny (612 rep)
Dec 1, 2017, 08:44 PM
Last activity: Jun 6, 2025, 07:59 AM