I have a string in a column that looks likes this
x = pd.DataFrame(data={'a':
[({"Name":"any","all":[{"First":"True","Second":False},{"Last":True,"Second":False}],"Entry":0})]}).applymap(str)
some random fields are not wrapped in quotation marks, but they should be. I tried stripping all quotes and then reinserting quotes around all words within the string with the following, but its not quite working correctly - as shown below
x['a'][0].strip(' \" ')
' '.join('"{}"'.format(w) for w in x['a'][0].split(' '))
which gives the following output
"{'Name':" "'any'," "'all':" "[{'First':" "'True'," "'Second':" "False}," "{'Last':" "True," "'Second':" "False}]," "'Entry':" "0}"
the expected output would be this
{"Name":"any","all":[{"First":"True","Second":"False"},{"Last":"True","Second":"False"}],"Entry":"0"}
any advice would be great. thanks so much!