Table for my folder structure
id | name | parent_id
----+--------------+-----------
1 | parent |
2 | child | 1
3 | grandchild A | 2
4 | grandchild B | 2
5 | grandchild c | 3
select id,parent_id, name from table.
I want to create a json for this result set which should be in tree structure.
how to make a json for this,
please help.
Something like this?
Edit: Or array: