I have this data in MySQL that looks like this (the actual data is different but I just to make it easer)
Note: children column is JSON
SELECT id, name, children FROM people;
| id | name | children |
|---|---|---|
| 2 | Jack | ["5", "3"] |
| 3 | John | Null |
| 5 | Sara | Null |
children can NOT have other children, children can NOT be in a different table because the data is similar and I need all the people at once, and I don't want to access the database for every child
The data should look like this after SELECT:
| id | name | children |
|---|---|---|
| 2 | Jack | [{'id': '5', 'name': 'Sara'},{'id': '3', 'name': 'John'}] |
| 3 | John | Null |
| 5 | Sara | Null |