JSON Editor FreeOpen the JSON editor

Docs/Search and replace

Search and replace in JSON

Search finds text in keys and values in every mode, counts the matches and steps through them. Replace changes one match or all of them at once.

Updated

Open this page in the editor

Find and replace

  1. Press the Search and replace button in the panel’s toolbar, or press Ctrl+F. Type what you are looking for.
  2. The count shows where you are, for example 1 of 4. Enter goes to the next match and Shift+Enter to the previous; F3 and Shift+F3 work too.
  3. Press the Replace button in the search bar, or Ctrl+H, and type the new text.
  4. Replace changes the current match; Replace all changes every match. Each is one undo step.

Keys

SearchCtrl+F
Next match (Enter in the search box)F3
Previous match (Shift+Enter in the search box)Shift+F3
Search and replaceCtrl+H
Replace all (in the replace box)Ctrl+Alt+Enter
Every shortcut

Find and replace in JSON: an example

Take a list of posts: [{"status":"draft","title":"Draft notes"},{"status":"published","title":"Launch"},{"status":"draft","title":"Q4 plan"}]. In tree mode, search for draft: the count shows 1 of 3, because search ignores case and also finds “Draft” in the first title.

Replace all with review gives [{"status":"review","title":"review notes"},{"status":"published","title":"Launch"},{"status":"review","title":"Q4 plan"}]. To change only the two statuses, step through the matches with Enter and press Replace on each status instead, or press Ctrl+Z once to take the whole Replace all back.

Numbers stay numbers. In {"timeout":30,"retries":3,"url":"http://api.test:30"}, searching for 30 finds 2 matches, and Replace all with 60 gives {"timeout":60,"retries":3,"url":"http://api.test:60"}: timeout is still the number 60, and the address is still text.

Where it looks

In text mode, search reads the text exactly as shown. In tree mode it reads every key and every value of the whole document, and opens the rows above the current match. In table mode it reads the array that the table shows.

Search ignores upper and lower case.

What replacing does

  • A match in a key renames the key, unless another key in that object already has the new name.
  • A match in a text value changes that part of the text.
  • A match in a number, true, false or null is replaced and read again: if the result is valid JSON it stays that kind of value, otherwise it becomes text.

Rename a key everywhere

To rename a key in every object of a document, for example userId to user_id, open tree mode, search for userId and press Replace all. Each match in a key renames that key; an object that already has a user_id keeps both keys as they were, so nothing is overwritten.

Replace all also changes values that contain the same text. Step through the matches with Enter first when the word can appear in values too, and use Replace on the ones you want.

Tips for search and replace in JSON

  • Search counts up to 100,000 matches in one document.
  • Every replace can be taken back: one press of Ctrl+Z restores the document as it was before Replace all. See undo and redo.
  • To change many values by a rule rather than by text, for example to keep only some items or pick one field, use a query in transform.
  • Text mode searches the JSON text itself, so it also finds quotes, commas and brackets. Tree and table mode search only keys and values.
  • A file over 100 MB opens view-only: search reads the whole file from your disk, and to change a match you open that part in the other panel and edit it there. See large JSON files.
  • To edit the match you land on, see editing in tree mode.
PreviousTransform and queriesNextUndo and redo