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 the other answers explain well the error occurs because of invalid quote characters passed to the json module.
In my case I continued to get the ValueError even after replacing ' with " in my string. What I finally realized was that some quote-like unicode symbols had found their way into my string:
“ ” ‛ ’ ‘ ` ´ ″ ′
To clean all of these you can just pass your string through a regular expression:
import re
raw_string = '{“key”:“value”}'
parsed_string = re.sub(r"[“|”|‛|’|‘|`|´|″|′|']", '"', my_string)
json_object = json.loads(parsed_string)