←back to thread

JSON Patch

(zuplo.com)
299 points DataOverload | 1 comments | | HN request time: 0.203s | source
Show context
graypegg ◴[] No.41880930[source]
I'm probably missing a use case here, but with the JSON Pointer spec they use feeling so "URL-y", couldn't you skip the whole meta-json syntax? So rather than doing

    HTTP/1.1 PATCH /user
    Content-Type: application/json-patch+json

    [
      {
        "op": "replace",
        "path": "/username",
        "value": "bob"
      }
    ]
why not

    HTTP/1.1 PATCH /user/username
    Content-Type: application/json

    "bob"
I feel like you could pretty sensibly implement replace/delete/append with that.

Edit: "test" and "copy" from the json patch spec are unique! So there is those, as well as doing multiple edits all at once in a sort of "transaction".

replies(3): >>41880995 #>>41881640 #>>41883343 #
1. DataOverload ◴[] No.41881640[source]
You might like JSON Merge Patch then - much simpler syntax that avoids the URL stuff