How editing works
JSON Digger edits JSON files without loading them into memory: you can change a value, edit a subtree as text, rename a key, insert or delete a node, sort an array, or apply a JSON Patch. Your edits go to a copy of the file. The original stays exactly as it is until you save.
What you can edit
Section titled “What you can edit”You can edit a JSON file opened from disk, in UTF-8, that is valid JSON and no larger than 2 GiB. Wait for a large file to finish indexing before the first edit.
These documents open read-only:
| Document | To change it |
|---|---|
| NDJSON and plain text files | Edit them in a text editor |
.gz and .zst archives, and merged documents |
Save As writes a file you can open; a JSON one can be edited |
| Pasted, fetched, and repaired documents | Save As writes a file you can open and edit |
| Files that are not valid JSON | Fix the error in a text editor first |
| Files in another encoding than UTF-8 | Convert them to UTF-8 first |
| Read-only files, or files in a read-only folder | Change the permissions, or use Save As to save a copy elsewhere |
When a document cannot be edited, the edit commands show the reason in parentheses, for example Edit Value… (Only JSON documents can be edited.).
Edits go to a copy
Section titled “Edits go to a copy”Each edit writes a complete copy of the file, with your change, next to the original. Other programs still see the original file, unchanged. The tab shows a dot for Unsaved edits, and you can undo the last edit.
On a large file, writing the copy takes about one to a few seconds per gigabyte. Meanwhile the status bar shows writing… N% with a Cancel this edit button; select it to stop the edit, and nothing changes. Files of 300 MiB and more show a notice before the first edit. For measured times, see Performance.
Until you save, up to three copies sit next to the file. Before each edit, JSON Digger checks that the file’s drive has room for the edited file plus 20%, and refuses the edit if not: “Not enough free disk space to edit this file.”
The copies are named after the file, for example .config.jdig-edit-0badf00d-1.json for config.json. JSON Digger deletes them when you save, discard the edits, or close the tab. If you find one while JSON Digger is closed and no recovery is offered for it, you can delete it.
Saving replaces the original
Section titled “Saving replaces the original”Save (Ctrl+S) replaces the original file with your edited version in one step, so the file is never half-written. After saving, the copies are deleted and undo starts over.
If another program changed the file while you were editing, JSON Digger shows a banner and asks before it overwrites the file. See Files with unsaved edits. Save also compares the file’s size and modification time with the file you started editing, so it asks even when no banner appeared, for example on a network drive that does not report changes.
If the file has other hard links, saving replaces this name only, and the other links keep the old contents; JSON Digger tells you so after the first edit.