Bad Unicode Escape in JSON – Fix \uXXXX Errors

Local only

A JSON Unicode escape must use \u followed by exactly four hexadecimal digits. Missing digits or characters outside 0-9 and A-F make the string invalid.

Indent

24 chars · 3 lines

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

Invalid JSONInvalid Unicode escape sequence
Line 2Column 18Character 20Found “G”
"symbol": "\u12G4"

JSON Unicode escape error

How to diagnose malformed JSON Unicode escapes

The \u escape has a fixed four-hex-digit form in JSON. A typo such as \u12G4, an incomplete sequence, or a backslash copied through another encoding layer can make the entire string fail parsing. 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. Locate the \u sequence nearest the parser failure.
  2. Verify that exactly four hexadecimal digits follow it.
  3. Correct the code point or use the intended literal Unicode character, then validate again.

JSON Unicode escapes have a fixed width

Each \u escape encodes one four-hex-digit UTF-16 code unit. Letters G through Z and any missing digit make the escape malformed before the parser can interpret its value.

  • Non-hexadecimal characters inside the four-digit sequence.
  • Only one, two, or three digits after \u.
  • Backslashes altered by another string or transport encoding layer.

Literal Unicode characters are valid JSON too

JSON text can contain ordinary Unicode characters directly. Use an escape only when your transport or generation process requires it; unnecessary manual escapes add another place for typos.

Bad Unicode escape example

G is not hexadecimal. The corrected example uses the valid escape for the letter A.

Invalid Unicode escape

{
  "symbol": "\u12G4"
}

Valid Unicode escape

{
  "symbol": "\u0041"
}

Common questions

Frequently asked questions

How many digits follow \u in JSON?

Exactly four hexadecimal digits follow each JSON \u escape.

Can JSON contain Unicode characters without \u escapes?

Yes. JSON text can contain Unicode characters directly, subject to normal string escaping rules.

Why does the same escape need more backslashes in JavaScript source?

A JavaScript string can add a separate escape layer before JSON.parse sees the JSON text. Inspect the runtime string to distinguish the two grammars.

Debugging a specific JSON issue? Browse JSON troubleshooting.