When I extract some data from a data-source the data is getting extracted as a string object and the json is being exported as a string.
I have tried
json.loads()
-> link1 Convert string to JSON in Python?
and
this convert a json string to python object
from other answers.
However, the expectation is
"details":
"{
'col1': 'col1_details',
'col2': 'col2_details',
'col3': 'col3_details'
}"
the expected outcome is
details":
{
'col1': 'col1_details',
'col3': 'col2_details',
'col3': 'col3_details'
}
as you see the extra quotes are causing the json to be read as a string and json.loads() and json.dumps() are not working.
I am open to any suggestions without using regex to create a json object directly/easily?
edit:
modified the string object - and the whole point as you see is that the data extraction process is creating a string instead of creating a json object bypassing an extra "" that makes it an invalid json object where I cannot use json.loads and json.dunps and hence the question.