Zum Inhalt springen
uencoder

Anwenden JSON Patch (RFC 6902) operations

JSON Patch defines ein sequence von operations (hinzufügen, entfernen, ersetzen, move, copy, testen) in modify ein JSON Dokument atomically.

  1. 1

    JSON Patch (RFC 6902) applies an array of operations to a JSON document. Operations: add (insert or replace), remove (delete), replace (overwrite), move (relocate), copy (duplicate), test (assert value before proceeding). Each operation uses a JSON Pointer path.

  2. 2
    JSON-Formatierer →

    Formatieren both the original document and the patch array to verify they are valid JSON. The patch is an array of {op, path, value?} objects. Format them to catch syntax errors before applying.

  3. 3
    JSON-Validator →

    Validieren the patch structure: each operation must have "op" (one of add/remove/replace/move/copy/test) and "path" (a JSON Pointer). Add and replace require "value"; move and copy require "from"; test requires "value" for comparison.

  4. 4

    The "test" operation is powerful for conditional patches: it verifies a value before applying subsequent operations. If any test fails, the entire patch is rejected (atomicity). Use test to implement optimistic concurrency: test the version field, then apply changes.

Häufige Fragen

Is JSON Patch atomic?
Yes. If any operation fails (e.g., test assertion fails, path does not exist for remove), the entire patch is rejected and the document is unchanged. This makes it safe for concurrent modifications with proper version testing.
JSON Patch vs JSON Merge Patch?
JSON Patch (RFC 6902) uses explicit operations (add/remove/replace) — more expressive. JSON Merge Patch (RFC 7396) is simpler: a single JSON object where null means delete and other values mean replace. Use Merge Patch for simple updates, JSON Patch for complex operations.

Workflows, die diese Aufgabe lösen

Namenskonvention umwandeln und als JSON validieren
Bezeichner in Ziel-Namenskonvention umwandeln, dann Ausgabe als JSON validieren zur Strukturbestätigung.
PIPELINE
Zwei YAML-Konfigurationen über JSON vergleichen
YAML-Konfigurationen in JSON umwandeln für diff-freundlichen Vergleich strukturierter Werte.
PIPELINE
JSON-Nutzlast für URL-Transport kodieren
Ein JSON-Dokument für URL-Parameter vorbereiten: pretty-print, Base64-kodieren, dann percent-kodieren — die exakte Umkehrung der verschachtelten Parameter-Dekodierungskette.
PIPELINE
HJSON zu JSON-Format
HJSON formatieren und in Standard-JSON umwandeln.
PIPELINE
JS formatieren und JSON validieren
JS-Code formatieren dann als JSON validieren.
PIPELINE
JSON formatieren und Integritäts-Prüfsumme berechnen
Ein JSON-Dokument pretty-printen und eine CRC32-Prüfsumme berechnen zur Erkennung nachfolgender Änderungen.
PIPELINE
JSON minifizieren und validieren
JSON für Inspektion formatieren und syntaktische Korrektheit in einem Durchgang validieren.
PIPELINE
JSON Schema generieren und validieren
Ein JSON Schema aus Beispieldaten generieren dann dagegen validieren.
PIPELINE
JSON formatieren und TypeScript-Interface generieren
Ein JSON-Dokument formatieren dann eine TypeScript-Interface-Definition inferieren in einer Kette.
PIPELINE
Validieren, formatieren, dann JSON zu YAML umwandeln
Eine (möglicherweise minifizierte) JSON-Konfiguration in YAML umwandeln, Syntaxfehler am ersten Knoten abfangen statt subtil falsches YAML zu erzeugen.
PIPELINE
JSON5 zu JSON-Format
JSON5 formatieren und in Standard-JSON umwandeln.
PIPELINE
JSONC zu JSON-Format
JSONC (JSON mit Kommentaren) formatieren und in Standard-JSON umwandeln.
PIPELINE
JWT-Payload dekodieren und formatieren
Ein JWT-Token parsen, Payload extrahieren und JSON formatieren für Inspektion.
PIPELINE
Query-String parsen und JSON formatieren
Query-String in Schlüssel-Wert-Paare parsen dann als JSON formatieren.
PIPELINE
TOML in JSON umwandeln
Eine TOML-Konfigurationsdatei in JSON parsen fuer Tools und APIs, die JSON-Eingabe erwarten.
PIPELINE
TOML ueber JSON in YAML umwandeln
Eine TOML-Konfigurationsdatei in YAML-Format umwandeln, mit JSON als Zwischendarstellung.
PIPELINE
Verschachtelten URL-Parameter dekodieren (Base64 JSON)
Einen URL-Parameter, der URL-kodiertes Base64-JSON transportiert, in lesbares formatiertes JSON entfalten.
PIPELINE
TypeScript-Interfaces aus YAML generieren
Ein YAML-Dokument in TypeScript-Interface-Definitionen umwandeln, mit JSON als Zwischenformat.
PIPELINE
YAML validieren und formatieren
YAML zu JSON umwandeln zur Strukturvalidierung, dann bestaetigen, dass das JSON well-formed ist.
PIPELINE

Verwandte Tools