I have multiple files of JSON-ish text that I need to merge:
{
"City1":
{
"Coords":
[
[10,20,30],
[11,21,31]
]
},
"City2":
{
"Coords":
[
[12,22,32]
]
}
}
{
"City1":
{
"Coords":
[
[13,23,33]
]
},
"City3":
{
"Coords":
[
[14,24,34],
[15,25,35]
]
}
}
City1, City2, etc. may extend into the dozens, each with a varying number of coordinates.
I understand that the files are not proper JSON but, when I pass the files through to_entries to correct "CityN" to "key":"CityN", then "Coords" is a level deeper and, in any case, almost everything I try to do with the result of to_entries returns Cannot index array with string "key".
I would like to get back
{
"City1":
{
"Coords":
[
[10,20,30],
[11,21,31],
[13,23,33]
]
},
"City2":
{
"Coords":
[
[12,22,32]
]
},
"City3":
{
"Coords":
[
[14,24,34],
[15,25,35]
]
}
}
but am at a loss for how to do it. Thank you very much for your help.