Catalog/data-transform-json-patch-apply

Data Transform

JSON Patch apply API

Applies an RFC6902 JSON Patch (add/remove/replace/move/copy/test) to a document, honoring '-' array append and failing loudly on test mismatches. Answers 'What does this document look like after applying these patch ops?', 'How do I apply an RFC6902 patch correctly?'.

Price$0.02per request
MethodPOST
Route/v1/data-transform/json-patch-apply
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
data-transformjson-patchrfc6902applydiffjsonwrangle
API URLhttps://x402.hexl.dev/v1/data-transform/json-patch-apply
Integration docs
Example request
{
  "document": {
    "a": 1,
    "b": {
      "c": 2
    }
  },
  "patch": [
    {
      "op": "replace",
      "path": "/a",
      "value": 9
    },
    {
      "op": "add",
      "path": "/b/d",
      "value": 3
    },
    {
      "op": "remove",
      "path": "/b/c"
    }
  ]
}
Example response
{
  "result": {
    "b": {
      "d": 3
    },
    "a": 9
  },
  "opsApplied": 3
}
Input schema
{
  "type": "object",
  "required": [
    "document",
    "patch"
  ],
  "properties": {
    "document": {
      "type": "object",
      "examples": [
        {
          "a": 1,
          "b": {
            "c": 2
          }
        }
      ]
    },
    "patch": {
      "type": "array",
      "examples": [
        [
          {
            "op": "replace",
            "path": "/a",
            "value": 9
          },
          {
            "op": "add",
            "path": "/b/d",
            "value": 3
          },
          {
            "op": "remove",
            "path": "/b/c"
          }
        ]
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}