Bad Control Character in JSON – Find Invalid String Characters

Local only

JSON strings cannot contain unescaped control characters from U+0000 through U+001F. Tabs, newlines, carriage returns, and similar characters must use JSON escape syntax.

Indent

27 chars · 3 lines

Two-way sync · Edit either side and the other updates automatically.

Invalid JSONUnescaped control character in string
Line 2Column 18Character 20Found tab
"value": "alphabeta"

JSON string control-character error

What bad control character means in JSON

Invisible characters can make a JSON string invalid even when the text looks normal on screen. A literal tab, newline, carriage return, or other low control character must be represented with a valid escape sequence. This tool is free to use. No account or payment is required.

Last updated

What you can do here

  • Browser-local JSON processing
  • Route-specific malformed JSON example
  • Focused parser or repair guidance
  • Broken and corrected JSON example
  • Related JSON problem navigation

Steps

  1. Inspect the parser context for tabs, newlines, carriage returns, or other invisible control characters inside a string.
  2. Replace the literal character with the appropriate JSON escape such as \t, \n, or \r.
  3. Regenerate JSON with a serializer when control characters come from arbitrary user text.

Invisible input often comes from copy and paste

Spreadsheet cells, terminal output, and multiline fields can contain tab or control characters that are hard to distinguish from ordinary spacing. The parser location is more reliable than visual inspection alone.

  • Literal tab characters between words.
  • Raw newlines or carriage returns inside a value.
  • Other U+0000 through U+001F characters inserted by external systems.

Escaping preserves the character without changing its meaning

Using \t or \n in raw JSON does not remove the tab or newline from the decoded string. It provides a legal textual representation that the parser can decode back to the intended character.

Literal tab control character example

The first value contains a real tab; the valid JSON represents that tab with the \t escape.

Invalid control character

{
  "value": "alpha	beta"
}

Valid escaped tab

{
  "value": "alpha\tbeta"
}

Common questions

Frequently asked questions

Which control characters are invalid inside JSON strings?

Unescaped characters from U+0000 through U+001F are not allowed inside JSON strings. Common examples are tab, newline, and carriage return.

Does escaping a tab remove it from the value?

No. The raw JSON uses \t, and the decoded string contains the tab character again.

Why can the JSON look normal but still fail?

Many control characters are invisible or rendered as ordinary spacing, so the source can appear readable while containing illegal raw characters.

Debugging a specific JSON issue? Browse JSON troubleshooting.