JSON Patch – a format for describing changes to a JSON document
11–20 of 112 posts
Re: JSON Patch – a format for describing changes to a JSON document
#12Re: JSON Patch – a format for describing changes to a JSON document
#13The thing you're competing against in terms of performance and efficiency is: 1. JSON.stringify() 2. Diff-match-patch: https://code.google.com/p/google-diff-match-patch/ 3. JSON.parse() There are several short-comings to the above approach though, specifically, you have to explicitly trade off performance vs. efficiency depending on the JSON you're dealing with. JSON Patch is going to give you a consistent performanc…
This is about sending a diff over the network without having to either have the full json document on hand, or worrying about other concurrent changes that might wreck the diff-match-patch. It's also json-aware versus operating on pure text which might lead to invalid json documents.
2. This is in no way better at handling concurrent changes than anything other diff format. In fact, the extra operations it has do nothing to help you here (it is as good and bad as copy/add, or insert/delete diffs). I'd love to know why you seem to think otherwise.
JSON awareness only helps when trying to apply partial patches. At that point, the only thing it can possibly buy you is syntactic correctness, which is worthless without semantic correctness (and in fact, sometimes worse)
Re: JSON Patch – a format for describing changes to a JSON document
#14The thing you're competing against in terms of performance and efficiency is: 1. JSON.stringify() 2. Diff-match-patch: https://code.google.com/p/google-diff-match-patch/ 3. JSON.parse() There are several short-comings to the above approach though, specifically, you have to explicitly trade off performance vs. efficiency depending on the JSON you're dealing with. JSON Patch is going to give you a consistent performanc…
I think you're missing the point. If I want to patch just one node and don't care what the rest of the document is, I cannot just use a text diff.
This seems like a trivial application of any copy/add delta format, which are easily expressed in text diff format.
Re: JSON Patch – a format for describing changes to a JSON document
#15The thing you're competing against in terms of performance and efficiency is: 1. JSON.stringify() 2. Diff-match-patch: https://code.google.com/p/google-diff-match-patch/ 3. JSON.parse() There are several short-comings to the above approach though, specifically, you have to explicitly trade off performance vs. efficiency depending on the JSON you're dealing with. JSON Patch is going to give you a consistent performanc…
Re: JSON Patch – a format for describing changes to a JSON document
#16We (Empirical) have implemented a similar couple years ago in our json-backed model. I see two big problems with this standard: 1. Why express paths as a string if you have the ability to encode it as an array in json? Otherwise you run up against the escaping problem for which they use ~0 and ~1 (of all things?!) which is only going to cause bugs. 2. Indexing into arrays is a problem in distributed computing because…
Re: JSON Patch – a format for describing changes to a JSON document
#17Here's a link to the original RFC from 2013: https://tools.ietf.org/html/rfc6902
A cool thing is the "test" operation. JSON patches are atomic, so you can put in something like:
{ "op": "test", "path": "/foo/bar", "value": 32 }
...and if { foo: { bar: 75 }}, none of the patch will be applied.Re: JSON Patch – a format for describing changes to a JSON document
#18Earlier quoted context omitted.
I think you're missing the point. If I want to patch just one node and don't care what the rest of the document is, I cannot just use a text diff.
Can you explain why? This seems like a trivial application of any copy/add delta format, which are easily expressed in text diff format.
Re: JSON Patch – a format for describing changes to a JSON document
#19"Add" seems like it's not idempotent as the existing value seems to change what it does.
Seems like a mistake to bundle array operations into "add" and "remove".
Array indexing is going to be useless for most applications because it makes assumptions about what's already there, and there is no way to specify fine-grained preconditions (or relativity such as "insert before the element 'b'").
No support for "increment", "decrement" or similar operations you'd want to make atomic.
No support for sets.
Unlike azinman2, I think paths as strings is fine. But why not support both? Let a path be either a string or an array.
Re: JSON Patch – a format for describing changes to a JSON document
#20 [
{ "$set": { "baz": "boo" } },
{ "$unset": { "foo": 1 } }
]