x402AgentTools

📊CSV ↔ JSON Converter

Convert CSV to JSON (array of objects keyed by the header row) and JSON arrays back to CSV. Handles quoted fields with embedded delimiters, escaped quotes and multi-line values per RFC 4180 conventions.

Worked examples

CSV → JSON

GET /api/v1/dev/csv-convert?data=name%2Crole%0Ajane%2Cadmin%0Abob%2Ceditor&direction=csv_to_json

Result: [ { "name": "jane", "role": "admin" }, { "name": "bob", "role": "editor" } ]

Quoted fields

GET /api/v1/dev/csv-convert?data=%22last%2C%20name%22%2Cage%0A%22Doe%2C%20Jane%22%2C31&direction=csv_to_json

Result: [ { "last, name": "Doe, Jane", "age": "31" } ]

JSON → CSV

GET /api/v1/dev/csv-convert?data=%5B%7B%22sku%22%3A%22A1%22%2C%22qty%22%3A3%7D%5D&direction=json_to_csv

Result: sku,qty A1,3

Machine API (x402)

$0.002 / call

This tool is also a JSON API for AI agents. Requests without payment receive 402 Payment Required plus instructions; agents pay USDC on Base via the x402 protocol — no accounts, no API keys.

GET /api/v1/dev/csv-convert?data=name%2Crole%0Ajane%2Cadmin%0Abob%2Ceditor&direction=csv_to_json HTTP/1.1
Host: localhost:3000

→ 402 (payment required, instructions in headers)
→ 200 (after X-PAYMENT header; JSON body below)

{
  "tool": "dev/csv-convert",
  "input": {"data":"name,role\njane,admin\nbob,editor","direction":"csv_to_json"},
  "result": { "value": 2, "answer": "[
  {
    "name": "jane",
    "role": "admin"
  },
  {
    "name": "bob",
    "role": "editor"
  }
]" }
}

Agent docs: /llms.txt · OpenAPI spec · integration guide

About this tool

CSV is the format every spreadsheet exports and every agent hates parsing — quoted fields, embedded delimiters and escaped quotes. This converts CSV to clean JSON arrays (keyed by the header row) and JSON arrays back to properly quoted CSV.

Frequently asked questions

Are quoted fields handled?

Yes — fields wrapped in double quotes may contain delimiters, escaped quotes ("") and newlines, per RFC 4180 conventions.

Related tools