pipr.tools
Pipes
Clean Email Strip formatting from pasted email for clean plain text Clean AI Output Clean plain text from ChatGPT or AI output Decode & Format JWT Decode a JWT and pretty-print header and payload Word Frequency Count word frequency in text

json-format Format and pretty-print JSON

⟐ Data
Input0 chars
Output0 chars

Flags

--indent number default: 2

Examples

Pretty-print a compact JSON object

Usage
"{"name":"Alice","age":30,"roles":["admin","editor"]}" | json-format

Format an analytics API response so it's readable

Usage
"{"campaign":"Summer 2025","clicks":4821,"conversions":312,"c..." | json-format

Make a server status JSON config human-readable

Usage
"{"server":"prod-1","status":"healthy","uptime":99.97,"region..." | json-format
View source
(input, opts = {})=>{
                try {
                    return JSON.stringify(JSON.parse(input), null, parseInt(opts.indent) || 2);
                } catch (e) {
                    return `Error: ${e.message}`;
                }
            }