JSON Pointer Token List Formatter

Format an explicit token list as an RFC 6901 pointer; an empty list is root and an empty token is an actual slash component.

Description

Format an explicit token list as an RFC 6901 pointer; an empty list is root and an empty token is an actual slash component.

Building a pointer from separate names requires escaping characters inside each name before adding separators. Otherwise a slash in a property name would create an extra path step.1

When to use this tool

Format an explicit token list as an RFC 6901 pointer; an empty list is root and an empty token is an actual slash component.

  • Prepare the supplied tokens 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

  1. Enter tokens. Use the exact text syntax, units and index conventions explained below.
  2. Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
  3. Read result.pointer. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.

For each supplied token, replace tilde with ~0 and slash with ~1, then join escaped tokens with slash separators and a leading slash. An empty token list produces the root pointer, empty text.2

Input fieldMeaning and representationAccepted input
tokenstokens.At most 128 strings, each at most 128 UTF-16 code units
Output fieldInterpretation
resultObject containing the named outputs below.
result.pointerThe pointer value under the stated formula or text convention.
json
{
  "input": {
    "tokens": [
      "a/b",
      "~",
      ""
    ]
  },
  "output": {
    "result": {
      "pointer": "/a~1b/~0/"
    }
  }
}

Limitations and assumptions

  • Tokens are literal names; a token containing ~1 is escaped again rather than treated as preencoded. URI percent encoding and document lookup are separate operations.
  • 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

  1. RFC 6901: JSON Pointer syntax and evaluation — RFC Editor

  2. Tool behavior and example: JSON Pointer Token List Formatter — tool.io

Similar or alternative tools

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