Zum Inhalt springen
uencoder

Verwenden JSON Pointer (RFC 6901) in Referenz Werte

JSON Pointer defines ein Zeichenkette syntax für identifying ein spezifisch Wert in ein JSON Dokument mit slash-separated path tokens.

  1. 1

    JSON Pointer (RFC 6901) uses "/" to separate path tokens and "~1" / "~0" to escape "/" and "~" in keys. For example, "/foo/bar" points to root.foo.bar. An empty string "" points to the root. It is the foundation for JSON Patch and JSON Schema.

  2. 2
    JSONPath-Abfrage →

    Evaluate a JSON Pointer expression against a JSON document. Enter the pointer (e.g., "/users/0/name") and the JSON to extract the referenced value. This is useful for validation and data extraction.

  3. 3
    JSON-Validator →

    Validieren the JSON document before applying the pointer. A pointer to a non-existent path returns null or raises an error depending on the implementation. Validate first to get a clear error message.

  4. 4

    JSON Pointer vs JSONPath: JSON Pointer is simpler (only slash-separated paths, no filters or wildcards) and is standardized (RFC 6901). JSONPath (like $.store.book[*].author) is more expressive but not standardized. Use JSON Pointer for simple references and JSON Patch; use JSONPath for complex queries.

Häufige Fragen

How do I escape special characters in JSON Pointer?
Use "~1" for "/" and "~0" for "~" in path tokens. For example, to reference the key "a/b", use "/a~1b". The tilde is escaped first, then the slash — "~01" decodes to "~1", not "/".
What is the empty JSON Pointer?
The empty string "" refers to the entire document (the root). This is different from "/" which refers to a key named "" (empty string key). The distinction matters in JSON Patch operations.

Workflows, die diese Aufgabe lösen

Verwandte Tools