JSONDecodeError Python Origin: Application & API Last updated 12 Oct 2026

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

The text passed to json.loads() isn’t JSON — at char 0 it’s usually empty or HTML.

Exact message you may see Expecting value: line 1 column 1 (char 0)Expecting property name enclosed in double quotes
Seen on: Python

Meaning

“Expecting value … (char 0)” means the very first character isn’t valid JSON: an empty response, an HTML error page, or a BOM. requests’ response.json() raises the same error.

Common causes

  • Empty response body (204, error)
  • HTML error/login page instead of JSON
  • File with BOM (use utf-8-sig)
  • Single quotes / Python dict repr instead of JSON

⚡ Quick fix

  1. Print response.status_code and response.text[:200] before parsing
  2. Check Content-Type
  3. Use json.loads(s) only on real JSON; ast.literal_eval for Python reprs

Detailed fix by platform

Python

  1. python
    r = requests.get(url, timeout=10)
    r.raise_for_status()
    data = r.json()

How to diagnose

  1. Raw — What is the text?
  2. Status — HTTP status code?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

DecodingError — Swift DecodingError: keyNotFound / typeMismatch / valueNotFound / dataCorrupted (iOS)DecodingErrorentity.parse.failed — API Error: Malformed JSON in request body (entity.parse.failed / JSON parse error) (API)entity.parse.failedHttpMessageNotReadableException — HttpMessageNotReadableException: JSON parse error / Required request body is missing (Java)HttpMessageNotReadabl…InvalidDefinitionException — com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class X and no properties discovered (Java)InvalidDefinitionExce…is an invalid start of a value — System.Text.Json: '<' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0 (.NET)is an invalid start o…MismatchedInputException — com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `java.util.ArrayList` from Object value (Java)MismatchedInputExcept…not JSON serializable — TypeError: Object of type datetime is not JSON serializable (Python)not JSON serializableSyntaxError: JSON — SyntaxError: Unexpected token < in JSON at position 0 (JavaScript)SyntaxError: JSONJSONDecod…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.