Description
Find literal linefeeds and carriage returns in fragment and return their zero-based UTF-16 offsets and a combined forbidden-raw-line-break flag.
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.
Find literal linefeeds and carriage returns in fragment and return their zero-based UTF-16 offsets and a combined forbidden-raw-line-break flag.
When to use this tool
Use JSON: JSON Newline Literal Escape Check when you need a narrowly defined JSON string or separator diagnostic.
How to use the tool and how it works
- Enter fragment. 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.
Find literal linefeeds and carriage returns in fragment and return their zero-based UTF-16 offsets and a combined forbidden-raw-line-break flag.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| fragment | Fragment | Required. Text. Implementation limit: 8192 Unicode code points and 16384 UTF-16 code units. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| result | Result | Required. Object. |
| result.rawLinefeedOffsets | Raw Linefeed Offsets | Calculated result member: array. |
| result.rawCarriageReturnOffsets | Raw Carriage Return Offsets | Calculated result member: array. |
| result.hasForbiddenRawLineBreak | Has Forbidden Raw Line Break | Calculated result member: boolean. |
{
"input": {
"fragment": "a\nb"
},
"output": {
"result": {
"rawLinefeedOffsets": [
1
],
"rawCarriageReturnOffsets": [],
"hasForbiddenRawLineBreak": true
}
}
} Limitations and assumptions
- This treats fragment as string content, not a whole document where whitespace between values may be legal; escaped backslash-n text is distinct.
- 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 Line Continuation Rejection
Detect a backslash followed by CRLF, CR, or LF.
- JSON String Tab Versus Space Lexeme
Parse lexeme as a string, count decoded tab and space code points, and return decodedLength in UTF-16 units.