I have the below JSON file which I'm getting from a API.
{"Key-1":"Value-1",
"Key-2":[{"Value-2"::Child_Value-1","Value-3":"Child_Value-2"}]
}
{"Key-21":"Value-21",
"Key-22":[{"Value-22":"Child_Value-21","Value-23":"Child_Value-22"}]
}
{"Key-31":"Value-31",
"Key-32":[{"Value-32":"Child_Value-31","Value-33":"Child_Value-32"}]
}
I understand that this does not qualify as JSON format, but what I'm trying to achieve is that I want to extract each of the individual objects and store them in a separate file.
For instance file1.json
should contain -
[{"Key-1":"Value-1",
"Key-2":[{"Value-2":"Child_Value-1","Value-3":"Child_Value-2"}]
}]
and file2.json
should contain -
[{"Key-21":"Value-21",
"Key-22":[{"Value-22":"Child_Value-21","Value-23":"Child_Value-22"}]
}]
I'm trying to do this through python and shell script, but its not leading me anywhere. Is there a good library in python/shell that'll help. I'm kind of constrained on the language to be used (python,shell-script)