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

- **ID:** `python/starlette-request-body-parsing`
- **Domain:** python
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Request body is empty or not valid JSON when trying to parse with request.json().

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.x | active | — | — |

## Workarounds

1. **** (90% success)
   ```
   Check content-type first: if request.headers.get('content-type') == 'application/json':
    data = await request.json()
else:
    return JSONResponse(status_code=415)
   ```
2. **** (85% success)
   ```
   Use a middleware to parse JSON and handle errors gracefully.
   ```

## Dead Ends

- **** — Works but masks the root cause; better to validate request content type. (50% fail)
- **** — body() returns bytes; need to decode and json.loads. (60% fail)
