I need to import a few external json data into a variable or into a single json file to then display that data with D3.
This is the format of the data that I need to import from each json file:
{
"name": "name1",
"version": "0.1.2",
"references": [
{
"url1": "http://example1.com"
},
{
"url2": "http://example2.com"
}
]
}
And this is the format of data that I need for the final json file/variable.
{
"nodes":[
{
"name": "name1",
"version": "0.1.2",
"references": [
{
"url1": "http://example1.com"
},
{
"url2": "http://example2.com""
}
]
},
{
"name": "name2",
"version": "1.6.0",
"references": [
{
"url1": "http://example34.com"
},
{
"url2": "http://example30.com""
}
]
},
{
...
...
}
],
"links":[
]
}
Basically I need to merge the data from the different json files inside the "nodes" array.
Any idea how could I do this? Thanks