Skip to content

Main content

JSON: JSON String Solidus Escape Choice Tool

Serialize one JSON string with explicit optional solidus escaping, delegating all other escaping to JSON.stringify.

Loading tool…

Description

Serialize text using JSON.stringify.

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.

Serialize text using JSON.stringify.

When to use this tool

Use JSON: JSON String Solidus Escape Choice when you need a narrowly defined JSON string or separator diagnostic.

How to use the tool and how it works

  1. Enter text, escapeSolidus. 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 result. Expand result to inspect the returned fields.

Serialize text using JSON.stringify. When escapeSolidus is true, additionally replace each forward slash with its escaped solidus spelling.1

Input fieldMeaning and unitsAccepted input
textTextRequired. Text. Implementation limit: 8192 Unicode code points and 16384 UTF-16 code units.
escapeSolidusEscape SolidusRequired. Boolean.
Output fieldInterpretationReturned shape
resultResultRequired. Object.
result.jsonStringJson StringCalculated result member: string.
json
{
  "input": {
    "text": "a/b",
    "escapeSolidus": true
  },
  "output": {
    "result": {
      "jsonString": "\"a\\/b\""
    }
  }
}

Limitations and assumptions

  • The two spellings decode to the same text; this option alone is not a complete HTML embedding or script-context safety policy.
  • 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

  1. Calculation and input contract: json/json-string-solidus-escape-choice — tool.io

Similar or alternative tools