Skip to content
screenjson

Schema & data

Diff two drafts of a screenplay

Compare two ScreenJSON files and produce a human-readable, scene-accurate diff report.

Last updated January 2026

Sorted-JSON diff

The simplest approach — canonicalise both files, then diff:

diff <(jq -S . draft-3.json) <(jq -S . draft-4.json)

jq -S sorts keys, which removes spurious ordering differences.

Scene-by-scene diff

For a more useful view, compare scenes by UUID:

jq -c '.document.scenes[] | { id, heading, body }' draft-3.json | sort > /tmp/a.txt
jq -c '.document.scenes[] | { id, heading, body }' draft-4.json | sort > /tmp/b.txt
diff /tmp/a.txt /tmp/b.txt

“Scenes added, removed, changed"

jq -r '.document.scenes[].id' draft-3.json | sort > /tmp/a.ids
jq -r '.document.scenes[].id' draft-4.json | sort > /tmp/b.ids

comm -23 /tmp/a.ids /tmp/b.ids   # removed scenes
comm -13 /tmp/a.ids /tmp/b.ids   # added scenes
comm -12 /tmp/a.ids /tmp/b.ids   # kept scenes (check for body changes)

"Which characters gained or lost lines?”

# Count lines per character in each draft, then join:
jq '…' draft-3.json > /tmp/counts3.json
jq '…' draft-4.json > /tmp/counts4.json
jq -s '.[0] as $a | .[1] as $b | …' /tmp/counts3.json /tmp/counts4.json

Substitute the counting query from the count speaking lines how-to.

Using the revisions field properly

If both drafts are tracked as revisions inside the same document — each with a UUID, label, and created timestamp — you can use the revision index to jump between them without maintaining two files.

Next