sanity-io/mendoza

Differ for structured documents (JSON)

Go

277

47 commits

updated Sep 5, 2026

See the code

README

Mendoza, differ for structured documents

Mendoza looks at two structured documents, referred to as left and right, and constructs a patch of the differences. By having the left document and the patch you'll be able to recover the right document. Mendoza is designed for creating a minimal patch, not necessarily a readable patch.

Example:

$ cat left.json
{"name": "Bob Bobson", "age": 30, "skills": ["Go", "Patching", "Playing"]}
$ cat right.json
{"firstName": "Bob Bobson", "age": 30, "skills": ["Diffing", "Go", "Patching"]}
$ dozadiff left.json right.json
[19,1,10,1,14,"firstName",11,2,20,"Diffing",21,0,2,15]

Features / non-features:

  • Lightweight JSON format.
  • Flexible format which can accommodate more advanced encodings in the future.
  • Differ/patcher available as a Go library (this repo).
  • Patcher available as a JavaScript library: mendoza-js.
  • Efficient handling of renaming of fields.
  • Efficient handling of reordering of arrays.
  • Not designed to be human readable.
  • The patch can only be applied against the exact same version.

Format: See docs/format.adoc

Contributors

judofyr

41 commits

rdyv

2 commits

rubioz

2 commits

renovate[bot]

1 commits

sanity-io/mendoza

Differ for structured documents (JSON)

Go

277

47 commits

updated Sep 5, 2026

See the code

README

Mendoza, differ for structured documents

Mendoza looks at two structured documents, referred to as left and right, and constructs a patch of the differences. By having the left document and the patch you'll be able to recover the right document. Mendoza is designed for creating a minimal patch, not necessarily a readable patch.

Example:

$ cat left.json
{"name": "Bob Bobson", "age": 30, "skills": ["Go", "Patching", "Playing"]}
$ cat right.json
{"firstName": "Bob Bobson", "age": 30, "skills": ["Diffing", "Go", "Patching"]}
$ dozadiff left.json right.json
[19,1,10,1,14,"firstName",11,2,20,"Diffing",21,0,2,15]

Features / non-features:

  • Lightweight JSON format.
  • Flexible format which can accommodate more advanced encodings in the future.
  • Differ/patcher available as a Go library (this repo).
  • Patcher available as a JavaScript library: mendoza-js.
  • Efficient handling of renaming of fields.
  • Efficient handling of reordering of arrays.
  • Not designed to be human readable.
  • The patch can only be applied against the exact same version.

Format: See docs/format.adoc

Contributors

judofyr

41 commits

rdyv

2 commits

rubioz

2 commits

renovate[bot]

1 commits

Languages

Go

60.4%

Assembly

39.6%