{"uid":"cap_4ts5kkr0VrqNwto8GgZQl","slug":"fastx402-lab-json-patch-apply-45b9733b","name":"FastX402 Lab – JSON Patch Apply","description":"200 pay-per-call tools for AI agents, from $0.001 per request in USDC on Base or Solana with x402. No account, no API key.","url":"https://fastx402.tools/json-patch-apply?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"queryParams":{"type":"object","required":["json","patch"],"properties":{"json":{"type":"string","description":"JSON document"},"patch":{"type":"string","description":"JSON Patch array, e.g. [{\"op\":\"replace\",\"path\":\"/a\",\"value\":2}]"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"result":{"type":"object","properties":{"name":{"type":"string"},"tools":{"type":"integer"},"chains":{"type":"array","items":{"type":"string"}}}}}}}}}},"responseSchema":{"type":"json","example":{"result":{"name":"fastx402","tools":104,"chains":["base","solana"]}}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.001","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_gi8d7jH2p8wcOF1rsah1s","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Applies an RFC 6902 JSON Patch (add, remove, replace, move, copy, test operations) to a JSON document and returns the patched result atomically.","exampleAgentPrompt":"Apply this JSON patch to my document — the document is {\"name\":\"fastx402\",\"tools\":100} and the patch is [{\"op\":\"replace\",\"path\":\"/tools\",\"value\":104},{\"op\":\"add\",\"path\":\"/chains\",\"value\":[\"base\",\"solana\"]}] — and give me the result.","exampleUseCases":[{"title":"Update nested config field","prompt":"I have a JSON config object {\"server\":{\"port\":8080,\"debug\":false}} and I want to apply the patch [{\"op\":\"replace\",\"path\":\"/server/debug\",\"value\":true}] — can you run that patch and return the updated config?"},{"title":"Atomic multi-op document edit","prompt":"Apply these three patch operations atomically to my JSON: add a new field, remove an old one, and test that the version is 2 — if the test fails I don't want any changes applied. The document is {\"version\":2,\"legacy\":true} and the patch is [{\"op\":\"test\",\"path\":\"/version\",\"value\":2},{\"op\":\"remove\",\"path\":\"/legacy\"},{\"op\":\"add\",\"path\":\"/active\",\"value\":true}]."},{"title":"Move and copy JSON fields","prompt":"Take my JSON object {\"a\":1,\"b\":2} and apply the patch [{\"op\":\"move\",\"from\":\"/a\",\"path\":\"/c\"},{\"op\":\"copy\",\"from\":\"/b\",\"path\":\"/d\"}] so that field a becomes c and b is also copied to d."}],"resultDescription":"Returns the fully patched JSON document as the 'result' field. If any patch operation fails (e.g. a 'test' op mismatch, a missing path, or an invalid operation), an error is returned and no partial changes are applied — the operation is atomic.","failureModes":["Invalid path reference returns an error with the offending path","Failing 'test' operation returns an error and no changes are applied","Malformed JSON in either the document or patch array returns a parse error","Invalid op value (not in add/remove/replace/move/copy/test) returns a validation error","Missing required query parameters (json or patch) returns a bad request error"],"whenToPreferThis":"Choose this endpoint when you need to apply RFC 6902-compliant JSON Patch operations atomically — especially when using 'test' operations to guard changes, or when mixing multiple ops (add, remove, replace, move, copy) and requiring all-or-nothing semantics. Prefer it over manual string manipulation or custom merge logic when working with structured JSON documents in an agent workflow at very low cost ($0.001/call).","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-27T19:21:24.174Z","isFirstParty":false,"canonicalSlug":"fastx402-lab-json-patch-apply-45b9733b"}