Description
Format codeUnit in 0-65535 as a lowercase four-digit JSON Unicode escape.
JSON strings use escape syntax, while decoded JavaScript strings are sequences of UTF-16 units. A supplementary Unicode scalar occupies a surrogate pair, and a lone surrogate is not a complete scalar.
Format codeUnit in 0-65535 as a lowercase four-digit JSON Unicode escape.
When to use this tool
Use JSON String Utf16 Codeunit Escape when you need a decoded UTF-16 or normalization diagnostic.
How to use the tool and how it works
- Enter codeUnit. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read escape, surrogate. Inspect surrogate before interpreting the associated values.
Format codeUnit in 0-65535 as a lowercase four-digit JSON Unicode escape. Flag units in the surrogate range.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| codeUnit | Code Unit | Required. Safe integer; minimum 0; maximum 65535. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| escape | Escape | Required. Text; maximum UTF-16 length 8192. |
| surrogate | Surrogate | Required. Boolean. |
{
"input": {
"codeUnit": 65
},
"output": {
"escape": "\\u0041",
"surrogate": false
}
} Limitations and assumptions
- A surrogate escape represents a code unit and may need a second escape for a Unicode scalar; the tool does not build a pair.
- 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.
- Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.
Alternative or Complementary methods
Use Unicode-aware text processing and a full JSON parser when decoding, comparing, or repairing complete documents.
References
Similar or alternative tools
- JSON String Utf16 Pair Assembly
Combine the pair as 65536 + (high - 55296) × 1024 + low - 56320 and return scalar and text.
- JSON String Escape Length One Codepoint
Validate point as a Unicode scalar and count its JSON string content units without outer quotes.