So I'm getting some data in the form of a string as a response after I make a request using the requests library, which I wanna finally convert into JSON using json.loads() method. The string is quite messy so I have to clean it so that it can be loaded as a JSON object.
The string can have extra quotation marks like:
{"address":""home address 25"street",
"date":"""}
What I am trying is to create a regexp that helps me in removing these extra quotations so the result is:
{"address":"home address 25 street",
"date":""}
What I thought of was to first create a regexp for all valid quotation marks and then try to match my string for all patterns except the matched ones and then replace them with an empty string like ''
Here's the regexp I tried but it fails to detect all valid quotations As shown in the image, the quotations above red dot are valid ones and should've been detected.
Note that the last red dot has two quotations above it, that's the kind of issue which I wanna solve.
Also ignore the blacked out part, that's sensitive info.