Package: effect
Module: JsonPointer
Escapes a JSON Pointer reference token according to RFC 6901 by encoding special characters so the token can be safely used as a segment in a JSON Pointer.
When to use
Use when you need to escape a single JSON Pointer path segment.
Details
~ (tilde) with ~0 and / (forward slash) with ~1Gotchas
The replacement order matters: ~ is replaced before / to prevent double-escaping.
Example (Escaping special characters)
import { JsonPointer } from "effect"
JsonPointer.escapeToken("a/b") // "a~1b"
JsonPointer.escapeToken("c~d") // "c~0d"
JsonPointer.escapeToken("path/to~key") // "path~1to~0key"
See
unescapeToken The inverse operation for decoding escaped tokensSignature
declare const escapeToken: (token: string) => string
Since v4.0.0