Hi! First, automerge doesn’t handle conflicts, which is the central point of Pijul.
One could write a diff algorithm that splits the data into words instead of lines: this would already make JSON merging better (hopefully). Other than that, diffing trees is not an easy algorithmic problem.
For json you’d probably want a slightly more aggressive variant of git word-diff: instead of splitting on whitespace, you’d split on every transition between alphanumeric and non-alphanumeric characters.
Or put the “word” boundaries inside every bracket or brace and after(before?) every comma and colon, but that’s less general-purpose
(And for well-behaved operations on trees in general, yeah at minimum you’d want to extent the pijul “x line is after y line” model to include “x line is child of y line, and comes before any line z that is after but not a descendant of x”. Idk whether there are any indentation-based heuristics doing this sort of thing already.)