Code Beautify / MULTIVERTO

Escape JSON Pointer token

Escape a property name for use as one JSON Pointer token.

Live converterYour input stays in this browser. No text is uploaded for conversion.
The file stays in your browser.
Chain tools

Apply each text tool to the previous result.

01 / Guide

How it works

Replace a tilde with ~0 and a slash with ~1 in that order.

Good to know

Escape a property name for use as one JSON Pointer token.

02 / Example

Example

Your inputname/a~b
Resultname~1a~0b

03 / Guide

Escape JSON Pointer token — How it works

What the conversion does

Escape a property name for use as one JSON Pointer token. Replace a tilde with ~0 and a slash with ~1 in that order.

Worked example

Start with the input shown on this page: name/a~b. The tool produces: name~1a~0b. Try the example first so you can compare the two representations. Then replace it with your own material. The result is plain text that you can copy into an editor, a test fixture or a request only after checking that its destination expects the same form.

Format rules and limits

A JSON Pointer is a sequence of reference tokens separated by literal slashes. This page transforms one token, not an entire pointer and not a URL fragment. RFC 6901 reserves two characters inside tokens: tilde is written ~0 and slash is written ~1. On decoding, ~1 must be handled before ~0, so ~01 becomes ~1 rather than a slash. Other tilde sequences are invalid and are rejected. For a full pointer, escape each property name separately and then join tokens with a leading slash. The empty token is allowed and names an empty-string property; it is different from an absent token. Do not apply generic URL encoding instead: percent escapes belong to a URI fragment representation and have a different layer of meaning.

Check the result

Keep the original beside the transformed text while you inspect it. Compare a small known case first, especially one containing punctuation, a non-ASCII character, a repeated value or an empty field relevant to your data. A readable output is not proof that the receiving program accepts the same schema or conventions. If you exchange data between applications, run the receiving parser and review a few records after import. Keep important source files under version control so changes are reversible. Processing takes place in your browser; this page does not send the pasted input to a conversion server. Browser memory and the clipboard still need ordinary care on shared devices.

The source and result have different roles even when they look similar. The method above defines the accepted subset rather than every extension of the named format. For a strict receiving system, try a small known case before changing many records. If validation fails, return to the original input and the first reported error; editing only the generated result can hide the cause.

To verify a pointer token, encode a property name and decode the output; the recovered text should match exactly, including any literal tilde or slash. When assembling a complete JSON Pointer, put slashes between already escaped tokens. A leading slash belongs to the pointer path and is not part of a token supplied to this tool. Test the special input ~1 separately because decoding order matters.

How this conversion transforms the input
Text — Input
Read and transform structure
Pointer token — Result