Skip to content

Instantly share code, notes, and snippets.

@zja711
zja711 / hierarchy-to-json.py
Last active August 25, 2017 10:34
transform hierarchy data to json format
import uuid
import itertools
import json
raw = [('a','b1'),
('a','b2'),
('b1','c1'),
('b1','c2'),
# ('c2','f1'),
# ('f1','g1'),
# ('g1','h1'),