3 ms·
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.
by kolev 12y ago
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.
- DannyBee 12y agoCan you explain why? This seems like a trivial application of any copy/add delta format, which are easily expressed in text diff format.
- jackhammer 12y agoA simple example: if the order of the keys is different, say because of a different json implementation, semantically the document is identical, but you can't apply the patch anymore.
- DonHopkins 12y agoThat's why you use a canonicalizing JSON serializer, which you'd also want to use if you were tracking changes to JSON in git, for example.
- azinman2 12y agoThat's very limiting. So I'm suppose to use the same Json library on various platforms for client as well as server? And what have you really gained?
- hmbg 12y agoThe OP was talking about the current incumbent, and the solution proposed does not work for web applications, since the JSON.stringify in most browsers do not sort keys. Sure, you could implement your own javascript version, but it will be at least a couple of orders of magnitude slower.
- DannyBee 12y agoThere are plenty of textual tree delta formats too.
- verroq 12y agoBecause you may not want to serialise your data. Because the order of a json dictionary key is undefined.
- kolev 12y agoText diff is based on surrounding lines, specifically, siblings, parents, and children in this case. In JSON Patch, only the parents matter.
- DannyBee 12y agoSo then it's a bad implementation of a textual tree diff algorithm .... which again, is a standard copy/add delta format (with a small amount of metadata).