Rename, insert, and delete
Besides changing values, you can rename a key, add a member to an object or an element to an array, and delete a node. Each is one edit that you can undo, and each keeps the formatting of the rest of the file. The commands are in the Node menu and at the top of a node’s context menu.
The root of the document cannot be renamed, deleted, or given a sibling.
Rename a key
Section titled “Rename a key”-
In the tree, select an object member and press Ctrl+F2, or right-click it and choose Rename Key….
-
Type the new key in the box that replaces the key in the row. Type it as plain text, without quotes; JSON Digger adds the quotes and escapes.
-
Press Enter to apply it, or Esc to cancel.
A key that the object already has is refused, so an object never ends up with two members of the same name. Array elements have no key to rename. A key that contains line breaks cannot be renamed in the row; JSON Digger opens its parent object in the subtree editor instead.
Insert a node
Section titled “Insert a node”Choose where the new node goes:
| Command | Shortcut | Adds the node |
|---|---|---|
| Insert Before… | Ctrl+Alt+Insert | Right before the selected node |
| Insert After… | Ctrl+Insert | Right after the selected node |
| Add Child… | Ctrl+Shift+Insert | As the last member or element of the selected object or array |
The dialog asks for:
- Key: for a member of an object. It must not exist yet.
- Value (JSON): any JSON value, such as
null,true,42,"text",[1, 2], or{"a": 1}. It can span several lines.
Select Insert, or press Ctrl+Enter in the value box. The new node is selected in the tree.
The new node is indented like its neighbors. Insert Before and Insert After follow the order in the file, even when Sort keys shows the keys in another order.
Delete a node
Section titled “Delete a node”Select the node and press Ctrl+Delete, or right-click it and choose Delete Node. The node is removed at once, without a confirmation, and its parent is selected. To bring the node back, press Ctrl+Z before your next edit; see Undo and redo.