for e in d:
    DG.add_node(e['id'], name=e['name'], type=e['type'])
if 'parent' in e:
    DG.add_edge(e['parent'], e['id'])
else:
    DG.add_edge('root', e['id'])
data = json_graph.tree_data(DG, root='root')
json.dumps(data['children'])
"""
'[{"children": [{"type": "folder", "name": "Folder 2", "id": "zRDg"}, {"type": "jpeg", "name": "DX00025.jpg", "id": "9Xdd"}], "type": "folder", "name": "Folder 1", "id": "OY00"}, {"type": "folder", "name": "Folder 3", "id": "ZDE1"}]'
"""
Sorting JSON object(s) into a Hierarchy