Description
Count consecutive backslashes at fragment's end.
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.
Count consecutive backslashes at fragment's end.
When to use this tool
Use JSON: JSON String Trailing Backslash Parity 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.
Count consecutive backslashes at fragment's end. Mark nextQuoteEscaped only when that count is odd.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.trailingBackslashes | Trailing Backslashes | Calculated result member: number. |
| result.nextQuoteEscaped | Next Quote Escaped | Calculated result member: boolean. |
{
"input": {
"fragment": "abc\\\\\\"
},
"output": {
"result": {
"trailingBackslashes": 3,
"nextQuoteEscaped": true
}
}
} Limitations and assumptions
- The fragment is not parsed as a full JSON string; the flag assumes the quote follows this run immediately inside a string.
- 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: 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.