想转个树型的json,主要是用来做权限的,学艺不精,一直没弄出来。。求指点!
这个是数据库结构...

想转成这种
[{ "title": "权限管理", "icon": "fa-cogs", "spread": false, "children": [{ "title": "用户管理", "icon": "fa-table", "href": "xx.html" },{ "title": "角色管理", "icon": "fa-table", "href": "xx.html" },{ "title": "邮件管理", "icon": "fa-table", "href": "xx.html" },{ "title": "操作日志", "icon": "fa-table", "href": "xx.html" }] }];
这个是数据库结构...

想转成这种
[{ "title": "权限管理", "icon": "fa-cogs", "spread": false, "children": [{ "title": "用户管理", "icon": "fa-table", "href": "xx.html" },{ "title": "角色管理", "icon": "fa-table", "href": "xx.html" },{ "title": "邮件管理", "icon": "fa-table", "href": "xx.html" },{ "title": "操作日志", "icon": "fa-table", "href": "xx.html" }] }];


