Python json.loads fails with `ValueError: Invalid control character at: line 1 column 33 (char 33)`

Another option, perhaps, is to use the strict=False argument

According to http://docs.python.org/2/library/json.html

“If strict is False (True is the default), then control characters will be allowed inside strings. Control characters in this context are those with character codes in the 0-31 range, including ‘\t’ (tab), ‘\n’, ‘\r’ and ‘\0’.”

For example:

json.loads(json_str, strict=False)

Leave a Comment