JSON with UTF-8 BOM – Find and Handle the Invisible BOM

Local only

A UTF-8 BOM is an invisible U+FEFF character that may appear before the first JSON token. VetaTool accepts one leading BOM while preserving error offsets against the original input.

Indent

20 chars · 3 lines

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

Valid JSON
1 keys0 arrays1 objects2 depth20 chars

JSON encoding troubleshooting

Why an invisible byte order mark can break JSON parsing

UTF-8 does not require a BOM, but some editors and exporters still prepend one. Native JSON.parse can treat that U+FEFF character as an unexpected token, while tools that deliberately normalize one leading BOM can parse the remaining document safely. 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 first code point or first three UTF-8 bytes for U+FEFF / EF BB BF.
  2. Remove the BOM at export time when you control the producer, or strip exactly one leading BOM before JSON.parse.
  3. Validate again and avoid removing U+FEFF characters that appear intentionally inside string values.

The BOM is invisible in many editors

A file can visually begin with { while actually containing U+FEFF first. Hex viewers, code-point inspectors, or a check such as text.charCodeAt(0) can reveal it.

  • Spreadsheet or legacy editor exports.
  • Text pipelines that preserve BOM markers while concatenating files.
  • Files saved as UTF-8 with BOM by editor settings.

Normalize only the leading marker

A BOM-like character inside a quoted JSON string may be real data. Limit cleanup to the first code point of the document rather than deleting every U+FEFF occurrence.

BOM-prefixed JSON example

The input contains an invisible U+FEFF before the opening brace. The corrected text begins directly with the JSON object.

JSON with leading BOM

{
  "name": "Ada"
}

JSON without BOM

{
  "name": "Ada"
}

Common questions

Frequently asked questions

Is a UTF-8 BOM required for JSON?

No. UTF-8 JSON does not require a BOM, and many parsers expect the first character to be the first JSON token.

How can I detect the BOM in JavaScript?

Inspect whether the string starts with U+FEFF, for example by checking text.charCodeAt(0) or text.startsWith("\uFEFF").

Does VetaTool accept BOM-prefixed JSON?

Yes. The JSON analyzer normalizes one leading BOM before parsing and keeps diagnostics aligned with the original input.

Debugging a specific JSON issue? Browse JSON troubleshooting.