How to Search JSON Data in Chrome: 5 Easy Ways
In this article
Searching through JSON data in Chrome is a common task for developers, testers, and anyone working with APIs. This guide shows you how to find specific keys, values, or text within JSON responses directly in the browser—no extra tools required beyond Chrome's built-in features and a few simple extensions. You'll learn methods ranging from the quickest (using the browser's native find) to more advanced (using the console and DevTools). By the end, you'll be able to locate any piece of data in a JSON payload quickly and efficiently.
What You'll Need
- Google Chrome installed (any recent version).
- A JSON file or a URL that returns JSON (e.g., an API endpoint).
- Basic familiarity with Chrome's Developer Tools (opening them with F12 or Ctrl+Shift+I / Cmd+Option+I).
- Optional: a JSON viewer extension like "JSON Viewer" or "JSON Formatter" from the Chrome Web Store (helps with readability but not required for searching).
Step-by-Step
Method 1: Using the Browser's Find Feature (on a raw JSON page)
- Open the JSON data in Chrome. If you have a URL that returns JSON, simply navigate to it. If you have a local file, drag it into Chrome or press Ctrl+O (Windows/Linux) or Cmd+O (Mac) and select the file.
- Press Ctrl+F (Windows/Linux) or Cmd+F (Mac) to open the find bar at the top-right corner of the window.
- Type the text you're looking for—this could be a key name (like "name"), a value (like "John"), or any string. Chrome will highlight all matches on the page.
- Use the up/down arrows in the find bar to jump between matches. The current match is highlighted in orange, others in yellow.
- If the JSON is very large (e.g., thousands of lines), Chrome may only show the first 100 matches. You can still use the find bar to navigate through them, but for a full search you may need to use the Console method below.
Method 2: Using the Network Tab to Search in API Responses
- Open Chrome DevTools by pressing F12 or Ctrl+Shift+I (Windows/Linux) or Cmd+Option+I (Mac).
- Click on the "Network" tab.
- Reload the page or trigger the API call you want to inspect. The network requests will appear in the list.
- Find the request that returns JSON (usually shown with a type of "xhr" or "fetch"). Click on it.
- In the panel that opens, click on the "Response" tab to see the raw JSON.
- Press Ctrl+F (or Cmd+F) to open the find bar within the Response tab. Type your search term and use the arrows to navigate matches.
- Alternatively, use the "Search" field in the Network tab (the magnifying glass icon) to search across all loaded resources. This is especially useful when you don't know which request contains the data.
Method 3: Using the Console with JavaScript (for complex searches)
- Open DevTools and click on the "Console" tab.
- If you have the JSON as a variable (e.g., from a fetch or a global variable), you can use JavaScript to search. If not, you can copy the JSON from the Response tab and assign it to a variable in the console.
- For a simple text search, use the
JSON.stringify()method to convert the object to a string, then use.includes()or a regular expression. For example, to find if the string "error" exists anywhere in the JSON, type:JSON.stringify(yourObject).includes('error') - To find all occurrences of a specific key, you can write a recursive function. Here's a simple one you can paste into the console:
function findKey(obj, key) {
let results = [];
for (let k in obj) {
if (k === key) results.push(obj[k]);
if (typeof obj[k] === 'object' && obj[k] !== null) {
results = results.concat(findKey(obj[k], key));
}
}
return results;
}
// Usage: findKey(yourObject, 'email')
- For searching by value, you can use a similar recursive function that checks both keys and values.
Method 4: Using a JSON Viewer Extension
- Install a JSON viewer extension from the Chrome Web Store (e.g., "JSON Viewer" or "JSON Formatter").
- After installation, open the JSON URL in a new tab. The extension will format the JSON with syntax highlighting and collapsible sections.
- Use the extension's built-in search feature (usually a search icon or Ctrl+F). Some extensions allow you to search only within expanded nodes, which can be faster for large files.
- If the extension doesn't have a search, you can still use Ctrl+F as in Method 1, but the formatting makes it easier to see the context.
Method 5: Using the DevTools "Search" Across All Files
- Open DevTools and click on the three-dot menu (⋮) in the top-right corner of the DevTools panel. Select "Search" or press Ctrl+Shift+F (Windows/Linux) or Cmd+Option+F (Mac).
- This opens a global search box that searches across all loaded scripts, stylesheets, and network responses.
- Type your search term and press Enter. A list of all matches will appear, showing the file and line number. Click on a result to jump to that location in the Sources or Network panel.
- This is particularly useful when the JSON is embedded in a JavaScript file or when you're debugging a web app.
Common Mistakes
- Forgetting to refresh the page after making changes to the JSON file or API response. Always reload to get the latest data.
- Searching in the wrong tab in DevTools. Make sure you're in the Response tab of the correct request, not the Preview tab (which shows a parsed view).
- Using the find bar on a formatted JSON when the extension has collapsed parts of the tree. The find bar only searches the visible text, so you might miss matches in collapsed nodes. Expand all nodes first (often by clicking a "Expand all" button) or use the extension's search.
- Case sensitivity—Chrome's find bar is case-insensitive by default, but if you use JavaScript's
indexOf()it is case-sensitive. UsetoLowerCase()if needed. - Assuming the JSON is a single object—if the JSON is an array, your recursive function should handle arrays too (the example above does, but only if you check for arrays explicitly).
Tips
- Use the
JSON.stringify()method in the console to quickly see the entire JSON as a string, then copy it to a text editor for a more powerful search (e.g., with regex). - If you're working with large JSON files, consider using the "Pretty Print" feature in the Response tab (the curly braces icon) to format the JSON. This makes it easier to read and search visually.
- For repeated searches, you can use the console to create a reusable function that takes a key or value and returns all matches. Save it as a snippet in DevTools (Sources > Snippets) for quick access.
- When using the Network tab, you can filter by type (e.g., XHR or Fetch) to quickly find API calls.
- If you need to search for a value that appears multiple times, use the global search (Ctrl+Shift+F) to see all occurrences at once, rather than cycling through them one by one.
Troubleshooting
- Find bar not showing any matches: Make sure the JSON is fully loaded. For large files, Chrome may not have rendered all text yet. Wait a moment and try again. Also, check that you're not accidentally searching in a different panel (like the Console) instead of the page.
- Search in Network tab not finding anything: The Network tab's search only works for responses that have been loaded. If the API call hasn't been made yet, you won't see it. Reload the page or trigger the request again. Also, ensure the response is not compressed (if it is, Chrome will decompress it automatically, but the search may not work on binary data).
- Console function returning undefined: If you're using the recursive function and it returns undefined, it means the key or value wasn't found. Check the spelling and case. Also, ensure your object is actually a JavaScript object, not a string. If you pasted JSON, use
JSON.parse()first. - Extension not working: Some JSON viewer extensions may not work on local files (due to Chrome's security restrictions). Try opening the JSON via a local server (e.g., using Python's
http.server) or use the built-in methods instead. - Find bar only shows first 100 matches: This is a Chrome limitation. For more than 100 matches, use the global search (Ctrl+Shift+F) or the console method to get a complete list.
Frequently Asked Questions
Can I search JSON data in Chrome without opening DevTools?
Yes, if the JSON is displayed as a plain page, you can use Ctrl+F (Cmd+F) directly on the page. This works for any text, including JSON.
Is there a way to search for a specific key in a JSON object using the console?
Yes, you can use the recursive function provided in Method 3. It will return all values for that key, regardless of nesting.
Why can't I find a value in the JSON when I know it's there?
Check if the value is in a collapsed section of a JSON viewer extension. Expand all nodes or use the extension's search feature. Also, make sure the value is not split across lines (e.g., a long string) and that you're using the correct case.
How do I search for a number or boolean in JSON?
You can search for the exact string representation (e.g., "123" or "true") using the find bar. For more precise searches, use the console method and compare with === to match the data type.
Can I search JSON data from a URL directly in Chrome?
Yes, navigate to the URL that returns JSON. Chrome will display it as plain text (or formatted if you have an extension). Then use Ctrl+F to search.
Does Chrome have a built-in JSON viewer that supports search?
Chrome does not have a native JSON viewer, but it does display JSON as plain text. You can use the find bar on that text. For a more visual experience, install a third-party extension.