JSON Editor FreeOpen the JSON editor

Docs/Undo and redo

Undo and redo JSON edits

Each panel keeps its own history. Every change in every mode can be undone, including copies between panels, opening a file, repairs and transforms.

Updated

Open this page in the editor

Go back a step

  1. Press the Undo button in the panel’s toolbar, or press Ctrl+Z.
  2. Press the Redo button, or press Ctrl+Y, to step forward again.
  3. Many toasts also have an Undo button for the change they report.

Keys

UndoCtrl+Z
RedoCtrl+Y
Every shortcut

Undo and redo JSON edits: an example

Undo takes back the last change in a panel and Redo puts it back, in text, tree and table mode alike. Here is what each press does to a small document.

Start in text mode with {"name":"Ada"} and type ,"age":36 before the closing brace without stopping. The panel now holds {"name":"Ada","age":36}, and that typing is one step, because keys pressed within a second of each other are grouped. Then press Format: the document is laid out on several lines, which is a second step.

Press Undo once and the document is back to {"name":"Ada","age":36} on one line. Press Undo again and the typing is gone: {"name":"Ada"}. Press Redo and ,"age":36 comes back in one go.

If you now type something new instead of pressing Redo again, the Format step can no longer be redone: a new change after an undo clears the steps ahead of it. The keys for both are in JSON editor keyboard shortcuts.

Across modes

History belongs to the document, not to a mode: type in text mode, switch to tree mode, and Undo still takes back the typing.

Typing is grouped: keys pressed within a second of each other form one step, so one Undo removes a burst of typing rather than one letter.

What history keeps

Each panel keeps up to 500 steps. History lives in memory: the documents are kept after a reload, but their undo history starts fresh.

Making a new change after an undo clears the steps you could have redone.

When the 500 steps are full, the oldest step is dropped to make room for the newest. Steps that keep a copy of a large text also count toward a memory cap of 64 MB per panel, so a panel holding a very large document in text mode keeps fewer steps.

What counts as one step

  • About a second of typing in text mode.
  • One edit in tree or table mode: a value, a key, an insert, a move or a removal.
  • Format, Compact or Repair of the whole document. See format, compact and repair JSON.
  • A sort or a transform applied to the document.
  • Replace or Replace all, however many matches it changed. See search and replace.
  • Opening a file or an address, or copying the other panel’s document across. See open, save and CSV.

Two panels, two histories

The left and right panels each have their own undo history. When you compare two documents and copy a whole side across, Undo in the panel that changed brings back its old document, and the other panel is not touched.

Undo takes back steps within the session. To get back a document you closed or replaced earlier, the History button in each panel’s toolbar lists the last 20 documents you worked on in this browser, and Restore loads one into that panel. See local storage and privacy.

PreviousSearch and replaceNextOpen, save and CSV