I\'ve been trying to figure out a good way to load JSON objects in Python. I send this json data:
{\'http://example.org/about\': {\'http://purl.org/dc/terms/
as JSON only allows enclosing strings with double quotes you can manipulate the string like this:
str = str.replace("\'", "\"")
if your JSON holds escaped single-quotes (\') then you should use the more precise following code:
import re
p = re.compile('(?
This will replace all occurrences of single quote with double quote in the JSON string str and in the latter case will not replace escaped single-quotes.
You can also use js-beautify which is less strict:
$ pip install jsbeautifier
$ js-beautify file.js