Pretty print, Compact & Stringify JSON from command line.
go build -o bin/json .
json -p
{"firstName":"John","lastName":"Doe"}
{
"firstName": "John",
"lastName": "Doe"
}
json -p '{"firstName":"John","lastName":"Doe"}'
{
"firstName": "John",
"lastName": "Doe"
}
echo '{
"firstName": "John",
"lastName": "Doe"
}' | json -c
{"firstName":"John","lastName":"Doe"}
Option | Description |
---|---|
-c | Compact: Compact JSON input in single line |
-p | Prettify: Print prettified JSON input |
-s | Stringify: Print stringified JSON string |