Skip to content

Main content

JSON String Tab Versus Space Lexeme Tool

Compute json string tab versus space lexeme from explicit bounded inputs.

Loading tool…

Description

Parse lexeme as a string, count decoded tab and space code points, and return decodedLength in UTF-16 units.

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.

Parse lexeme as a string, count decoded tab and space code points, and return decodedLength in UTF-16 units.

When to use this tool

Use JSON String Tab Versus Space Lexeme when you need a decoded UTF-16 or normalization diagnostic.

How to use the tool and how it works

  1. Enter lexeme. 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 tabs, spaces, decodedLength. Use the output convention below.

Parse lexeme as a string, count decoded tab and space code points, and return decodedLength in UTF-16 units.1

Input fieldMeaning and unitsAccepted input
lexemeSupplied token spelling; it is not automatically decoded text.Required. Text; maximum UTF-16 length 8192.
Output fieldInterpretationReturned shape
tabsTabsRequired. Safe integer.
spacesSpacesRequired. Safe integer.
decodedLengthDecoded LengthRequired. Safe integer.
json
{
  "input": {
    "lexeme": "\"a\\tb c\""
  },
  "output": {
    "tabs": 1,
    "spaces": 1,
    "decodedLength": 5
  }
}

Limitations and assumptions

  • Escaped tabs count after decoding, while literal unescaped controls can make the JSON invalid; other whitespace is not counted as space.
  • 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

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-tab-versus-space-lexeme — tool.io

Similar or alternative tools