Home / Companies / Sanity / Blog / Post Details
Content Deep Dive

Mendoza - The totally non-human readable diff format for structured JSON documents

Blog post from Sanity

Post Details
Company
Date Published
Author
Magnus Holm
Word Count
1,045
Language
English
Hacker News Points
-
Summary

Mendoza is a compact, non-human-readable diff format created to efficiently express differences between JSON documents, developed due to the lack of an existing efficient solution for JSON diffs. Unlike typical diffs made for human readability, Mendoza uses a series of opcodes, consisting of integers and strings, to encode operations that transform one JSON document into another in the most minimal way possible. This approach allows for efficient data transfer over networks and parsing in browsers, but it does not guarantee consistency if the underlying document changes post-patch creation. Implemented in Go and available on GitHub, Mendoza is also supported by a JavaScript parser and is used in applications like Sanity Studio to enhance real-time data synchronization. The name "Mendoza" was inspired by a character from "The Good Place," chosen for its catchy nature rather than its relevance to the project's functionality.