I have a dataset with invalid json, see snippet below:
{'id': 613, 'name': "new year's eve"}
I want to replace all the single quotes except apostrophes like in: new year's. So the string above should result in valid json like:
{"id": 613, "name": "new year's eve"}
I have tried a simple string replace in Python: string.replace("'", "\""), but this also changes the apostrophe resulting in:
{"id": 613, "name": "new year"s eve"}
Is there a way to fix this with regex, like replace all ' except when encapsulated by "?