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
- Enter text. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- 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 field | Meaning and units | Accepted input |
|---|---|---|
| text | Text | Required. Text. Implementation limit: 8192 Unicode code points and 16384 UTF-16 code units. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| result | Result | Required. Object. |
| result.leadingBom | Leading Bom | Calculated result member: boolean. |
| result.contentOffsetUtf16 | Content Offset Utf16 | Calculated result member: number. |
{
"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
Similar or alternative tools
- JSON String BOM Outside Value Flag
Flag a BOM at text position zero separately from any BOM found in text.slice(1).
- JSON: JSON Newline Literal Escape Check
Find literal linefeeds and carriage returns in fragment and return their zero-based UTF-16 offsets and a combined forbidden-raw-line-break flag.