{'name': 'cat12', 'subcats': [{'name': 'cat10', 'id': 10, 'parent_id': 8},
    {'name': 'cat12', 'id': 12, 'parent_id': 10}], 'id': 12, 'parent_id': 10},
Create hierarchical json dump from list of dictionary in python