# JSON editor

> Format, search and edit JSON in the desktop app, and the keyboard shortcuts it supports.

The same JSON editor is used wherever you write JSON in the desktop app:

* [Redux](/docs/desktop/redux/) › **Dispatch** and [Zustand](/docs/desktop/zustand/) › **Call**
* The [Notifications](/docs/desktop/notifications/) payload
* [TanStack Query](/docs/desktop/tanstack-query/) › **Overwrite data**
* [Storage](/docs/desktop/storage/) string values, when you edit or add a key
* [Commands](/docs/desktop/commands/) arguments of type JSON
* [Settings › Environments](/docs/desktop/settings/environments/#editing-as-json) › **View as JSON**

## Formatting

Click **Format JSON** at the top right of the editor, or press the shortcut (`Shift`+`Option`+`F`, or `Shift`+`Alt`+`F` on Windows and Linux), to indent the JSON with 2 spaces. If the JSON is invalid, it’s left as it is and a message says so.

## Searching and replacing

Click **Search**, or press `Cmd`+`F` (`Ctrl`+`F` on Windows and Linux), to find text in the editor. Press `Cmd`+`R` (`Ctrl`+`R` on Windows and Linux) to open it with the replace box focused. Press `Enter` or `Shift`+`Enter` to move to the next or previous match, and press `Esc` to close it.

**Match case**, **Use regular expression** and **Match whole word** change how the text is matched. **Replace** changes the current match, and **Replace all** changes every match.

## Variables

Type `{{` to pick a [variable](/docs/desktop/settings/environments/#using-variables) from the active environment. References to variables are highlighted. Variables can’t be used in **View as JSON**.

## Keyboard shortcuts

| Action                 | macOS                           | Windows and Linux            |
| ---------------------- | ------------------------------- | ---------------------------- |
| Format                 | `Shift`+`Option`+`F`            | `Shift`+`Alt`+`F`            |
| Find                   | `Cmd`+`F`                       | `Ctrl`+`F`                   |
| Replace                | `Cmd`+`R`                       | `Ctrl`+`R`                   |
| Suggest a variable     | `Ctrl`+`Space`                  | `Ctrl`+`Space`               |
| Indent or outdent      | `Tab` or `Shift`+`Tab`          | `Tab` or `Shift`+`Tab`       |
| Undo                   | `Cmd`+`Z`                       | `Ctrl`+`Z`                   |
| Redo                   | `Cmd`+`Shift`+`Z`               | `Ctrl`+`Y`                   |
| Fold or unfold         | `Cmd`+`Option`+`[` or `]`       | `Ctrl`+`Shift`+`[` or `]`    |
| Move a line up or down | `Option`+`Up` or `Down`         | `Alt`+`Up` or `Down`         |
| Copy a line up or down | `Shift`+`Option`+`Up` or `Down` | `Shift`+`Alt`+`Up` or `Down` |

## Applying changes

Nothing is sent while you type. Your changes apply when you click the panel’s button, such as **Dispatch**, **Call**, **Send to device** or **Save**. While the JSON is invalid, the problem is shown under the editor and the button is disabled. In Commands, **Run** shows the problem instead of running.

**View as JSON** has no button: your changes apply when you click out of the editor, if the JSON is valid.
