I have a JSON file with content
{"name" : "Conrad", "info" : "tst", "children" : [
{"name" : "Rick" },
{"name" : "Lynn" },
{"name" : "John", "children": [
{"name" : "Dave", "children": [
{"name" : "Dave" },
{"name" : "Chris" }
]},
{"name" : "Chris" }
]}
]};
I want to import this JSON file data inside a JavaScript file and have the final result like
var treeData ={"name" : "Conrad", "info" : "tst", "children" : [
{"name" : "Rick" },
{"name" : "Lynn" },
{"name" : "John", "children": [
{"name" : "Dave", "children": [
{"name" : "Dave" },
{"name" : "Chris" }
] },
{"name" : "Chris" }
]}
]};
I've tried many code samples but none have worked.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…