Quick answer
Responses can be truncated, contain BOM or extra bytes, or mix JSON with text.
API Malformed Response
Responses can be truncated, contain BOM or extra bytes, or mix JSON with text. Parsers need a single, complete JSON value.
Common causes
- Response cut off (connection closed, size limit).
- BOM or whitespace before/after the JSON.
- Multiple JSON values or concatenated strings without array/object wrapper.
How to fix
- Validate the raw response to see where the structure breaks.
- Strip BOM and trim; ensure a single root JSON value.
- Increase timeouts or buffer size if truncation is likely.
FAQ
- What is a BOM in JSON?
- Byte Order Mark (e.g. EF BB BF) at the start of a file. Some parsers reject it; strip it before parsing.
- Can response have multiple JSON objects?
- Standard JSON is one value per document. NDJSON (newline-delimited) is one JSON per line; parse line by line.
Fix it now
Try in validator (prefill this example)