I have a structure as follows:-
{
"data" : {
"links" :[{"url" : "https://foo", "title" : "St. Mary's Church"}]
}
}
I am using pandas to output this to Excel format, edit and then import.
with pd.ExcelWriter(parameters['path']) as writer:
df = pd.json_normalize(features)
df.to_excel(writer, sheet_name="test)
The problem is that pandas is writing this field out as follows into the Excel column data.links:-
[{'url' : 'https://foo', 'title' : "St. Mary's Church"}]
I want to read it back in as JSON using javascript but JSON.parse fails as the object keys have single quotes. I cannot globally convert to double quotes (easily) as that causes issues with the apostrophe in St. Mary's.
Is there a better solution in pandas? Or a straightforward regex to convert the string back to JSON in javascript. I can only use native javascript, do not have access to third party libraries.