ripgrep Basics/Emit machine-readable JSON results

Use structured output for editor integrations and automation.

Section: Pipes and stdin

Emit machine-readable JSON results

bash
bash
rg --json 'panic!' src/
Explanation

JSON output is ideal when a script or UI needs precise match spans and file metadata.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Pipes and stdin
Search standard input
Use ripgrep in a pipeline.
OpenIn sheetbashsame section
Search logs from another command
Filter live or recent command output with rg.
OpenIn sheetbashsame section
Search file lists or command results
Use another command to produce candidate text and rg to filter it.
OpenIn sheetbashsame section
Treat input as NUL-separated data
Search data that uses NUL delimiters instead of newlines.
OpenIn sheetbashsame section
Search recursively in the current directory
Search for a pattern using ripgrep's recursive defaults.
OpenIn sheetbash1 tag match
List only file names with matches
Return matching file paths without printing the matching lines.
OpenIn sheetbash1 tag match