I have a string which is badly formated for JSON.parse
.
It looks like this:
user_data = "{'key1':'val','key2':"bad_val with 'quoted' text"}"
I want to convert this somehow and parse with JSON.parse()
. If it weren't for this bad_val
simple replace(/'/g, '"')
would help, but with this I'm stuck. What is the correct way of converting this?