/json JSON Formatter & Validator

Pipe messy JSON in, get it validated, indented and colorized back — or a clear parse error pointing at the problem. Like jq . without needing jq installed.

GET · POST HTTPS only no signupnothing stored
curl --data-binary @data.json curlhub.sh/json

Usage

With curl

curl --data-binary @data.json curlhub.sh/json
printf '{"b":2,"a":1}' | curl --data-binary @- curlhub.sh/json
some-command | curl --data-binary @- curlhub.sh/json

With the CLI

cat data.json | curlhub json
kubectl get pod -o json | curlhub json

Structured output for scripts

curl -s --data-binary @data.json curlhub.sh/json -H 'Accept: application/json'

Output

Parameters

InputWhat it does
--data-binary @-Read the JSON from stdin — pipe a file or an API response.
--data-binary @fileFormat a file directly.
Accept: application/jsonReturn the reserialized JSON (compact/validated) for scripts.

Recipes

Lint an API response in a pipe

curl -s api.example.com/v1/thing | curl --data-binary @- curlhub.sh/json

A non-zero exit and an error line means the upstream returned invalid JSON.

Pretty-print a config on the fly

cat tsconfig.json | curlhub json