Hey all the example below is what I currently get when I run the query below: { "data": [{ "id": "546789434", "photo": "rru7ehklu.jpg" }, { "id": "546789434", "photo": "934bu9rg9w3rg.jpg" }, .......... { "id": "546789434", "photo": "er6u57kerethu]} Code (markup): Using this query here: SELECT CONCAT("{""data"": [", GROUP_CONCAT( CONCAT("{""id"":""",fbid,""","), CONCAT("""photo"":""",photoName,"""}") ) ,"]}") AS json FROM fbphotos; Code (SQL): This does produce the needed schema but the two issues are: There are 440 rows in the fbphotos table and yet this JSON output only has 13... It truncates abruptly at the 13 row data while it is creating the output. If I do a SELECT fbid, photoName FROM fbphotos I get back all 440 rows without an issue. I checked the 13th row in the fbphotos table and the photo name was like every other one that came before and after it so its not caused by some type of special character or anything making it end abruptly. What could I be missing?
I suspect the group concat has a limit - someone has probably documented it somewhere and 13 seems a reasonable cutoff. I come from the school of thought where you get the database to do as much of the heavy lifting as possible. This is not one of those times. Every serverside script, including whichever one you're using, will have a json_encode function to convert an array into JSON. Use it.