JSON pipeline
Validate, pretty-print, and convert JSON to CSV in one pass - the complete JSON processing workflow.
3 tools run server-side in one request. You pay once, settle once, and get a single response - no orchestration, no per-step payments, and a partial-success envelope if any step fails. USDC over x402 on any supported chain.
When to use this pack
An agent receives raw JSON (from an API response, a webhook body, or user input) and needs to validate it's well-formed, format it for readability, and convert it to CSV for a spreadsheet or data pipeline. Three tools in one payment.
Tools in this pack
All 3 run inside the single $0.004 call above. Each is also callable on its own if you only need one part.
- JSON Schema validate POST /api/json-validate Validate a JSON document against a JSON Schema (draft-07 subset) and get the list of violations. Supports type, required, properties, items, enum, const, min/max, length, pattern, format, anyOf/allOf/oneOf/not, additionalProperties. Deterministic - check an agent's structured output before you trust it.
- JSON validate & format POST /api/json-format Validate, pretty-print (any indentation, 0-8 spaces), or minify JSON, optionally with object keys sorted. canonical: true returns the RFC 8785 (JCS) canonical form - keys sorted, no whitespace, ECMAScript number and string serialization - plus its SHA-256, for hashing and signing. Numbers are read as IEEE-754 doubles and a duplicate key keeps its last value. Returns parse errors with position when invalid.
- JSON to CSV POST /api/json-to-csv Convert a JSON array of objects to CSV. Nested objects are flattened to dot-path columns.
Bought one at a time, these 3 tools cost $0.004 together; the pack is that sum less a 10% bundle discount, rounded up to the $0.001 settlement floor, which is $0.004.
Workflow
- Call json-validate to confirm the input is well-formed JSON (catches syntax errors, trailing commas, etc.).
- Call json-format to pretty-print with consistent indentation.
- Call json-to-csv to convert the JSON array to a CSV string for spreadsheet import.
Arguments
| Name | Required | Description | Example |
|---|---|---|---|
json | yes | JSON string to process | [{"name":"Alice","age":30}] |
What one call returns
A JSON object with pack, args, steps, summary; steps holds one entry per tool (json-validate, json-format, json-to-csv), each with its own result or error. Full example on the API page.
Call it directly
Any x402 client pays the 402 and gets the whole workflow back in one response. With the agent402-client SDK (npm i agent402-client, an ES module):
import { Agent402 } from "agent402-client";
// payFetch: an x402-wrapped fetch your wallet signs (@x402/fetch).
// Tools on the free tier need no options: new Agent402() pays them by proof-of-work.
// an existing prepaid credits key also works: new Agent402({ creditsKey })
const client = new Agent402({ fetch: payFetch });
const result = await client.call("skill-json-pipeline", {"json":"[{\"name\":\"Alice\",\"age\":30}]"});
Run it in Claude
claude mcp add agent402 -s user -- npx -y agent402-mcp@latest
Then paste this prompt into Claude:
Process this JSON using Agent402's json-pipeline skill pack: [{"name":"Alice","age":30}]. (1) Validate it, (2) pretty-print it, (3) convert to CSV. Report any validation issues and provide the formatted output.