Skip to content

Main content

JSON: JSON Document BOM Offset Tool

Report a decoded leading FEFF and its UTF-16 offset for JSON preprocessing diagnostics; does not strip, parse or claim RFC8259 producers may emit a BOM.

Loading tool…

Description

Inspect the first UTF-16 unit for U+FEFF.

A JSON lexeme is its textual spelling, which differs from the decoded value. Escapes, quotes, raw control characters, and surrounding whitespace must be interpreted in context.

Inspect the first UTF-16 unit for U+FEFF.

When to use this tool

Use JSON: JSON Document BOM Offset when you need a narrowly defined JSON string or separator diagnostic.

How to use the tool and how it works

  1. Enter text. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read result. Expand result to inspect the returned fields.

Inspect the first UTF-16 unit for U+FEFF. Return leadingBom and a contentOffsetUtf16 of one when present, otherwise zero.1

Input fieldMeaning and unitsAccepted input
textTextRequired. Text. Implementation limit: 8192 Unicode code points and 16384 UTF-16 code units.
Output fieldInterpretationReturned shape
resultResultRequired. Object.
result.leadingBomLeading BomCalculated result member: boolean.
result.contentOffsetUtf16Content Offset Utf16Calculated result member: number.
json
{
  "input": {
    "text": "{}"
  },
  "output": {
    "result": {
      "leadingBom": true,
      "contentOffsetUtf16": 1
    }
  }
}

Limitations and assumptions

  • The BOM is not removed and the rest of the document is not parsed or validated.
  • Outputs are nested inside result. Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.

Alternative or Complementary methods

Parse the entire document when validity matters; a local pattern match cannot establish complete JSON syntax.

References

  1. Calculation and input contract: json/json-document-bom-offset — tool.io

Similar or alternative tools