MySQL v5.7.22 onwards you should be able to use JSON_ARRAYAGG to select grouped attributes as a json array. Something like:
SELECT id, JSON_ARRAYAGG(JSON_OBJECT("a", t.a, "b", t.b)) as json from table t group by id;
This should return an array of json objects as second attribute in result set
| id | json |
-------------
| 1 | [{"a": "a-value-1", "b", "b-value-1"}, {"a": "a-value-2", "b": "b-value-2"}] |







![Cannot read property ‘toLowerCase’ of undefined [ERROR] An error occurred while running subprocess cordova.](https://blog.rahulbhutani.com/wp-content/uploads/2020/12/ionic-enable-xcode-permissions-banner-100x70.png)










