invalid_json
HTTP Status: 400 Bad Request
Example response
What happened?
The request body could not be parsed as valid JSON. This happens when:- The JSON syntax is malformed (missing quotes, trailing commas, unescaped characters)
- The request body is empty when JSON was expected
- The body contains non-JSON content (e.g. form-encoded data)
How to fix
- Validate your JSON: Use a JSON linter or
JSON.parse()locally before sending - Set the Content-Type header: Include
Content-Type: application/json - Check for trailing commas: JSON does not allow trailing commas after the last element
Common mistakes
- Trailing commas:
["a", "b",]is invalid JSON - Single quotes: JSON requires double quotes.
{'key': 'value'}is invalid - Unescaped characters: Special characters in strings must be escaped
- Empty body: Sending a POST with no body when JSON is expected
Related errors
validation_error- JSON is valid but fails schema validation