What Is JSON Patch?
I actually have a need for something like this. I wrote a single-user flashcard app which supports multi-device sync. The way I sync is having each device write to its own journal file a list of commands, such as &quot;create card&quot; or &quot;update card with ID 1234&quot; or &quot;insert card evaluation&quot;. To &quot;sync&quot;, each device just pushes up its journal to a common file store and pulls down each other device&#x27;s journals. Then it just plays back all the edits in timestamp order. (It works fine for single-user since you&#x27;re very unlikely to be using two devices at the exact same time.)<p>Anyway, I never did end up implementing an optimal &quot;update card with ID 1234&quot;. If you edit a flashcard&#x27;s front text, instead of updating the front text field alone, I ended up just writing out an entirely new copy of the flashcard in the journal (with the ID 1234 encoded). Super inefficient.<p>I was toying with the idea of coming up with a simpler format that does basically what this JSON patch does, where you an just encode &quot;update object 1234&#x27;s field foo.bar.baz to string ABC&quot;.<p>I figured I&#x27;d only need a handful of operations, to insert a new object, replace a node in an object&#x27;s property tree given a key path, delete an object, append to an array property, etc.<p>If anyone has other solutions other than JSON Patch, I&#x27;d love to hear about them.