Skip to content

Main content

JSON String Utf16 Pair Assembly Tool

Calculate json string utf16 pair assembly from explicit caller-supplied inputs.

Loading tool…

Description

Combine the pair as 65536 + (high - 55296) × 1024 + low - 56320 and return scalar and text.

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.

Combine the pair as 65536 + (high - 55296) × 1024 + low - 56320 and return scalar and text.

When to use this tool

Use JSON String Utf16 Pair Assembly when you need a decoded UTF-16 or normalization diagnostic.

How to use the tool and how it works

  1. Enter high, low. 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 scalar, text. Use the output convention below.

Require high in 55296-56319 and low in 56320-57343. Combine the pair as 65536 + (high - 55296) × 1024 + low - 56320 and return scalar and text.1

Input fieldMeaning and unitsAccepted input
highHighRequired. Safe integer; minimum 55296; maximum 56319.
lowLowRequired. Safe integer; minimum 56320; maximum 57343.
Output fieldInterpretationReturned shape
scalarScalarRequired. Safe integer.
textTextRequired. Text; maximum UTF-16 length 8192.
json
{
  "input": {
    "high": 55357,
    "low": 56832
  },
  "output": {
    "scalar": 128512,
    "text": "😀"
  }
}

Limitations and assumptions

  • Both units must form a valid pair; this does not parse JSON escapes or normalize the resulting character.
  • 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

  1. Calculation and input contract: json/json-string-utf16-pair-assembly — tool.io

Similar or alternative tools