Formatter Validator Minifier Escape / Unescape JSON ↔ String JSON ↔ YAML JSON → CSV NDJSON / JSON Lines JSON → Types JSON ↔ XML JSON Diff JSON Patch Canonicalize (RFC 8785) Schema Validator Schema Generator JSONPath Tester JWT Decoder JSON Errors Schemas More Tools
JSONTools / JSON errors / Literal tab inside a JSON string
JSON error registry · String content

Literal tab inside a JSON string

A raw tab character inside string content. Like a newline, it is a control character and must be escaped.

The input

Fails to parse
{"a": "col1	col2"}
Parses correctly
{"a": "col1\tcol2"}

Open this broken input in the formatter →

How to fix it

Escape it as `\t`.

Tabs *between* tokens are fine — this only applies inside a string.

What each parser reports

Every message below was captured by running this exact input through the parser named. 13 of 21 parsers rejected it; 8 accepted it.

Parser Exact message
CPython json.loads
CPython 3.12.3
Invalid control character at: line 1 column 12 (char 11)
what this message means →
encoding/json Unmarshal
Go go1.22.2
invalid character '\t' in string literal
what this message means →
Gson
Java 21.0.12
accepted — no error
Gson JsonParser (lenient off)
Java 21.0.12
accepted — no error
hjson
Node.js 22.22.2
accepted — no error
Jackson ObjectMapper
Java 21.0.12
Illegal unquoted character ((CTRL-CHAR, code 9)): has to be escaped using backslash to be included in string value
what this message means →
JavaScriptCore JSON.parse
JavaScriptCore (Bun 1.4.1)
JSON Parse error: Unterminated string
what this message means →
json-bigint
Node.js 22.22.2
accepted — no error
JSON5
Node.js 22.22.2
accepted — no error
JSON::PP
Perl 5.038002
invalid character 0x9 encountered while parsing JSON string, at character offset 11 (before "\x{9}col2"}")
what this message means →
json_decode
PHP 8.3.6
Control character error, possibly incorrectly encoded
Newtonsoft.Json JsonConvert
Newtonsoft.Json 13.0.3 on .NET 8.0.30
accepted — no error
Newtonsoft.Json JsonTextReader
Newtonsoft.Json 13.0.3 on .NET 8.0.30
accepted — no error
orjson
CPython 3.12.3
unexpected control character in string: line 1 column 12 (char 11)
what this message means →
Ruby JSON.parse
Ruby 3.2.3
unexpected token at '{"a": "col1 col2"}'
serde_json::from_str
Rust (serde_json 1.x)
control character (\u0000-\u001F) found while parsing a string at line 1 column 12
what this message means →
SpiderMonkey JSON.parse
SpiderMonkey 115
JSON.parse: bad control character in string literal at line 1 column 12 of the JSON data
what this message means →
System.Text.Json Deserialize
.NET 8.0.30
'0x09' is invalid within a JSON string. The string should be correctly escaped. Path: $ | LineNumber: 0 | BytePositionInLine: 11.
what this message means →
System.Text.Json JsonDocument
.NET 8.0.30
'0x09' is invalid within a JSON string. The string should be correctly escaped. LineNumber: 0 | BytePositionInLine: 11.
what this message means →
ujson
CPython 3.12.3
accepted — no error
V8 JSON.parse
Node.js 22.22.2
Bad control character in string literal in JSON at position 11 (line 1 column 12)
what this message means →

What the specification says

The exact sections that govern this error. Descriptions are our paraphrase; follow the links for the normative text.

Body Section
IETF
A string begins and ends with a quotation mark. Any Unicode character may appear between them except the quotation mark, the reverse solidus, and the control characters U+0000 through U+001F, which the section requires to be escaped. It also fixes the escape set and the \uXXXX form.
Ecma International
A string is code points wrapped in quotation marks; the quotation mark, reverse solidus and U+0000–U+001F must be escaped. Table 3 fixes the escape sequences.

Other errors in this category

Literal newline inside a JSON string

A real line break between the quotes. JSON forbids unescaped control characters (U+0000 to U+001F) inside strings, and a newline i…

Invalid escape sequence in a JSON string

A backslash followed by a character JSON does not define. The complete set is `\" \\ \/ \b \f \n \r \t` and `\uXXXX`. Windows path…

Malformed \u escape in a JSON string

A `\u` not followed by exactly four hexadecimal digits.…

Truncated \u escape in a JSON string

A `\u` escape with fewer than four hex digits, typically where a string was cut mid-escape by a length limit.…

Lone surrogate in a JSON string

A high surrogate (`\uD800`–`\uDBFF`) with no following low surrogate. Characters outside the Basic Multilingual Plane — emoji, mos…

Raw NUL byte inside a JSON string

A U+0000 byte in string content, usually from a C string boundary, a fixed-width database column, or binary data that was treated …

← All JSON parser errors