The input does not contain any JSON tokens. Expected the input to start with a valid JSON token, when isFinalBlock is true. LineNumber: L | BytePositionInLine: C.
This message comes from System.Text.Json JsonDocument on .NET 8.0.30. In this registry it is produced by 2 distinct mistakes. Positions in the real message vary with your input; the causes do not.
What produces this message
Empty string passed to a JSON parser
Exact message: The input does not contain any JSON tokens. Expected the input to start with a valid JSON token, when isFinalBlock is true. LineNumber: 0 | BytePositionInLine: 0.
Fix: Check for an empty body before parsing, and log the status code and content-length alongside it.
Whitespace-only input
Exact message: The input does not contain any JSON tokens. Expected the input to start with a valid JSON token, when isFinalBlock is true. LineNumber: 1 | BytePositionInLine: 2.
Fix: Treat whitespace-only as empty and handle it before parsing.
What other parsers say about the same input
If a colleague reports a different message for what looks like the same file, this is why.
| Parser | Message for the same inputs |
|---|---|
| CPython json.loads | Expecting value: line L column C (char N) |
| JSON5 | JSON5: invalid end of input at 1:1JSON5: invalid end of input at 2:3 |
| JSON::PP | malformed JSON string, neither array, object, number, string or atom, at character offset N (before "…") |
| JavaScriptCore JSON.parse | JSON Parse error: Unexpected EOF |
| Ruby JSON.parse | unexpected token at '…' |
| SpiderMonkey JSON.parse | JSON.parse: unexpected end of data at line L column C of the JSON data |
| System.Text.Json Deserialize | The input does not contain any JSON tokens. Expected the input to start with a valid JSON token, when isFinalBlock is true. Path: $ | LineNumber: L | BytePositionInLine: C. |
| V8 JSON.parse | Unexpected end of JSON input |
| encoding/json Unmarshal | unexpected end of JSON input |
| json-bigint | Unexpected '' |
| json_decode | Syntax error |
| orjson | Input is a zero-length, empty document: line L column C (char N)input data is empty: line L column C (char N) |
| serde_json::from_str | EOF while parsing a value at line L column C |
| ujson | Expected object or value |
Standards this registry is checked against
- RFC 8259 (STD 90) — The JavaScript Object Notation (JSON) Data Interchange Format, T. Bray, Ed., 2017. The IETF Internet Standard for JSON. Obsoletes RFC 7159 and RFC 4627.
- ECMA-404, 2nd edition — The JSON Data Interchange Syntax, Ecma International, 2017. Ecma’s grammar for JSON. A normative reference of RFC 8259; the two define the same syntax.
- The Unicode Standard — The Unicode Standard, Core Specification, The Unicode Consortium, current. Normatively referenced by RFC 8259 for the definition of a character.
- IEEE 754-2019 — IEEE Standard for Floating-Point Arithmetic, IEEE, 2019. Referenced by RFC 8259 §6 as the basis for its interoperability guidance on numbers.
Only standards bodies and peer-reviewed venues are cited. Error strings on this site are observed by executing each parser; the standards above define what the parser is reacting to.