JSON Byte Size Tool

ActualJSON.parse→compactJSON.stringifyUTF8bytes,countnormalizedserializationnotoriginalwhitespace bytes;isolatedsurrogatesescaped byJSON.stringify. Explicitboundedofflineconvention,not authoritative external identity,eligibility,clinical or safe-use determination.

Description

JSON byte size depends on the exact serialization being counted.

JSON byte size depends on the exact serialization being counted.1

This tool measures compact normalized JSON in UTF-8, so source indentation and whitespace do not contribute.

When to use JSON Byte Size Tool

Use this tool to apply the stated json byte size tool operation with an explicit input and unit basis.

How to use JSON Byte Size Tool and how it works

  1. Establish the text or game convention described above.
  2. Enter actualJsonText and run the tool.
  3. Read result.normalizedJsonUtf8Bytes using the output meanings below.
  4. If input is rejected, correct the stated type, range, ordering or alignment issue and rerun; review successful results under the declared convention.
Input fieldMeaningValue typeRequirement
actualJsonTextJson text, on the basis specified in the algorithm.stringrequired; further conditions in the algorithm

Parse valid JSON text, stringify the parsed value compactly, then count UTF-8 bytes. JavaScript numeric representation and JSON escaping determine the normalized bytes.

bytes = UTF8Length(JSON.stringify(JSON.parse(text)))

Apply the declared units, ordering and branch conditions.

Output fieldMeaningValue type
resultObject containing the declared output fields.object
result.normalizedJsonUtf8BytesByte count of compact parsed-and-reserialized JSON in UTF-8.number
json
{
  "input": {
    "actualJsonText": "{\"x\":\"🌙\"}"
  },
  "output": {
    "result": {
      "normalizedJsonUtf8Bytes": 12
    }
  }
}

Limitations and assumptions

The output applies the declared operation to the values you supply. Establish the measurement basis, units, coefficients and any caller-selected rules before interpreting it. The tool does not independently collect or verify observations or decide whether a model or reference applies. Duplicate object keys and numeric precision follow JSON.parse; compact reserialization is not a byte-for-byte preservation of the source.

Supply explicit required fields with the documented types and dense aligned arrays. Unknown fields, wrong types and nonfinite numbers are rejected. Branch-specific constraints are explained above. A successful false boolean, negative signed difference, empty slice or unresolved tie is distinct from an input error. Very large inputs or outputs may be rejected by shared resource limits.

Alternative or Complementary methods

Use JSON Minifier to complement this result. Produce compact JSON text for comparison with the normalized byte count.

Use UTF-8 Byte Counter to complement this result. Count the bytes of literal text when the original whitespace and source representation must be included.

References

  1. JSON Byte Size Tool — tool.io

Similar or alternative tools

  • JSON Minifier

    Produce compact JSON text for comparison with the normalized byte count.

  • UTF-8 Byte Counter

    Count the bytes of literal text when the original whitespace and source representation must be included.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies