← Back to marketplace

JSON Formatter

Validate and pretty-print JSON strings. Check if a JSON string is valid and format it with configurable indentation.

infra
by APIHub2 endpoints100% uptime15ms avg

Endpoints

POST/json/format
$0.0010/req

Pretty-print JSON. Body: {"input": "{...}", "indent": 2}

Request schema

inputstringrequired
indentinteger
POST/json/validate
$0.0010/req

Validate JSON. Body: {"input": "{...}"}

Request schema

inputstringrequired

Quick start

Easiest way: the APIHub CLI. Credits cover x402, no wallet needed.

# install and set up once
npx @apihubio/cli register
npx @apihubio/cli topup 10

# call this service
npx @apihubio/cli call "https://proxy.apihub.io/json-formatter/json/format" \
  -d '{"input":"{\"a\":1,\"b\":[2,3]}","indent":2}'

Or call the proxy directly (curl / any HTTP client):

curl -X POST https://proxy.apihub.io/json-formatter/json/format \
  -H "Authorization: Bearer ahk_your_key" \
  -H "Content-Type: application/json" \
  -d '{"input":"{\"a\":1,\"b\":[2,3]}","indent":2}'

# If credits available: charged automatically, returns 200
# Otherwise: returns 402 (pay via @x402/fetch or top up credits)

Pricing calculator

Estimate your monthly cost for JSON Formatter.

POST /json/format$0.0010/req
-
POST /json/validate$0.0010/req
-