simplejson.errors.JSONDecodeError: Invalid control character at: line 1 column 10 (char 9): what it means and how to fix it
Troubleshoot simplejson.errors.JSONDecodeError: Invalid control character at: line 1 column 10 (char 9) quickly and validate JSON locally (no upload).
What the error means
simplejson.errors.JSONDecodeError: Invalid control character at: line 1 column 10 (char 9) means the parser expected valid JSON but encountered a character/token that cannot appear there. In practice, it usually means the input is not JSON (or not strict JSON), or it is incomplete.
Most common real-world causes
- The input is not strict JSON (single quotes, comments, trailing commas).
- The response is truncated (missing closing } / ] / ").
- The response contains a prefix/suffix (logs, banners, debug output).
- The payload has invalid escapes or control characters in strings.
- You are parsing the wrong thing (already-parsed object, HTML, CSV, etc).
Fast debugging steps
- Validate the JSON as-is to get an exact error location.
- Check the first and last 50 characters for truncation and prefixes.
- Fix one issue at a time and re-validate after each change.
Code example (python)
import json
raw = response_text
print(repr(raw[:200]))
if not raw.strip():
raise ValueError('empty JSON input')
obj = json.loads(raw)
Fix without uploading data
If the JSON contains sensitive data, validate and fix it locally. No Upload Tools runs 100% in your browser.
- JSON Validator to pinpoint the exact syntax error.
- JSON Repair to remove comments/trailing commas when the source is not strict.
- JSON Formatter to pretty-print and inspect structure.
- JSON String Escape if the issue is inside a string (newlines/tabs/quotes).
Workflow: validate -> fix the first error -> validate again -> export/convert.
FAQ
Does the exact token matter? Yes. The token often hints at the root cause: < is usually HTML, u is often undefined, and / often points to comments.
Should I just regex-fix JSON? Avoid blind regex edits. Validate after each change so you know what you fixed and what broke.