Strict JSON Pointer Token Unescaper
Strictly unescape one RFC 6901 token, rejecting invalid tilde escapes and decoding only once.
Description
Strictly unescape one RFC 6901 token, rejecting invalid tilde escapes and decoding only once.
Decoding a JSON Pointer token requires strict escape handling. Replacement order matters because the encoded tilde in ~01 must not trigger a second decoding pass.1
When to use this tool
Strictly unescape one RFC 6901 token, rejecting invalid tilde escapes and decoding only once.
- Prepare the supplied token fields for this operation.
- Compare the complete example with the representation used by your own input before carrying the result into another step.
How to use the tool and how it works
- Enter token. Use the exact text syntax, units and index conventions explained below.
- Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
- Read result.unescaped. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.
Reject every tilde not immediately followed by zero or one. Replace ~1 with slash first and ~0 with tilde second, leaving all other characters unchanged.2
| Input field | Meaning and representation | Accepted input |
|---|---|---|
| token | token. | Text; at most 8,192 UTF-16 code units, subject to the grammar above |
| Output field | Interpretation |
|---|---|
| result | Object containing the named outputs below. |
| result.unescaped | The unescaped value under the stated formula or text convention. |
{
"input": {
"token": "~01~1"
},
"output": {
"result": {
"unescaped": "~1/"
}
}
} Limitations and assumptions
- This processes a single encoded token, not a whole pointer or URI fragment. For example, ~01 becomes literal ~1, while a lone tilde is an error.
- Decoded JSON is bounded to 20,000 nodes and 32 nesting levels; record arrays have at most 128 records. Parsed number values use JavaScript floating point rather than arbitrary-precision decimal arithmetic.
- Every declared top-level field is required and unexpected fields are rejected. Numeric inputs must be finite; ordinary text fields are bounded to 8,192 UTF-16 code units, with tighter operation-specific limits where stated.
- Ordinary string lists have at most 128 entries of at most 128 code units each; numeric lists and matrices have separate bounded size checks. Nonfinite results and excessively large serialized outputs are rejected.
- Indexes are zero-based and spans have an exclusive end unless explicitly stated otherwise. A valid false, null or empty-list result is distinct from malformed input.
Alternative or Complementary methods
For document-wide requirements, combine these structural inventories with an explicit JSON Schema. Preserve the distinction between missing properties and null values, and between numbers and numeric-looking strings when building joins or indexes.
References
Similar or alternative tools
- JSON Pointer Array Index Token Check
Audit a decoded JSON Pointer array index token: canonical decimal, safe integer, in-range and optional append marker are distinct checks.
- JSON Pointer Parent and Final Token
Split an RFC 6901 pointer into parent pointer and decoded final token; root has no parent or final token.