# JSON Patch apply

Apply a JSON Patch (RFC 6902) to a document: add, remove, replace, move, copy and test.

- Endpoint: `POST https://setget.net/v1/tools/json-patch-apply` with JSON `{"input": {...}}`
- MCP: `run_tool` with `slug` = `json-patch-apply`
- Page: https://setget.net/tools/json-patch-apply

## Inputs

- `text` (required, string): The JSON document to change.
- `patch` (required, string): A JSON array of patch operations.
- `indent` (optional, integer, default `2`, range 0..8): Spaces per level. 0 gives one compact line.

## Example

```json
{"input":{"text":"{\"a\":1,\"b\":[1,2]}","patch":"[{\"op\":\"replace\",\"path\":\"/a\",\"value\":2},{\"op\":\"add\",\"path\":\"/b/-\",\"value\":3}]","indent":0}}
```

Result:

```json
{"text":"{\"a\":2,\"b\":[1,2,3]}","applied":2}
```
