# JSON API
> A fast, fully-local JSON and CSV toolkit: validate JSON (with a clear error message, type and size), pretty-print and format it (with optional deep key-sorting), minify it (reporting bytes saved), and convert between CSV and JSON — RFC-4180 CSV parsing with automatic value typing, and JSON arrays to CSV. Every endpoint accepts input via the query string or the request body (up to 1 MB). Pure server-side compute, no third-party upstream, so responses are instant and always available. Ideal for data pipelines, ETL, webhooks, config tooling and developer utilities.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/json-api/..."
```

## Pricing
- **Free** (Free) — 14,000 calls/Mo, 3 req/s
- **Basic** ($3/Mo) — 300,000 calls/Mo, 12 req/s
- **Pro** ($12/Mo) — 1,600,000 calls/Mo, 40 req/s
- **Mega** ($33/Mo) — 8,000,000 calls/Mo, 120 req/s

## Endpoints

### JSON

#### `GET /v1/csv2json` — Convert CSV to JSON

**Parameters:**
- `csv` (query, required, string) — CSV with header row Example: `name,age
Ada,36`
- `delimiter` (query, optional, string) — Delimiter (default ,) Example: `,`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/json-api/v1/csv2json?csv=name%2Cage%0AAda%2C36&delimiter=%2C"
```

**Response:**
```json
{
    "data": {
        "rows": [
            {
                "age": 36,
                "name": "Ada"
            }
        ],
        "count": 1,
        "columns": [
            "name",
            "age"
        ]
    },
    "meta": {
        "timestamp": "2026-05-30T09:00:24.165Z",
        "request_id": "adfd26e6-bc1b-470d-b9d3-49afac186deb"
    },
    "status": "ok",
    "message": "OK",
    "success": true
}
```

#### `GET /v1/format` — Pretty-print JSON

**Parameters:**
- `json` (query, required, string) — JSON string Example: `{"b":2,"a":1}`
- `indent` (query, optional, string) — Indent 0-10 (default 2) Example: `2`
- `sort_keys` (query, optional, string) — Deep-sort keys Example: `false`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/json-api/v1/format?json=%7B%22b%22%3A2%2C%22a%22%3A1%7D&indent=2&sort_keys=false"
```

**Response:**
```json
{
    "data": {
        "result": "{\n  \"b\": 2,\n  \"a\": 1\n}",
        "size_bytes": 22
    },
    "meta": {
        "timestamp": "2026-05-30T09:00:24.253Z",
        "request_id": "2898bd6e-c04f-434d-8e7e-df6a681f1dcc"
    },
    "status": "ok",
    "message": "OK",
    "success": true
}
```

#### `GET /v1/json2csv` — Convert JSON to CSV

**Parameters:**
- `json` (query, required, string) — Array of flat objects Example: `[{"a":1,"b":2}]`
- `delimiter` (query, optional, string) — Delimiter (default ,) Example: `,`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/json-api/v1/json2csv?json=%5B%7B%22a%22%3A1%2C%22b%22%3A2%7D%5D&delimiter=%2C"
```

**Response:**
```json
{
    "data": {
        "count": 1,
        "result": "a,b\n1,2",
        "columns": [
            "a",
            "b"
        ]
    },
    "meta": {
        "timestamp": "2026-05-30T09:00:24.321Z",
        "request_id": "3ed43f62-591e-4a60-8b0d-6a092669be1c"
    },
    "status": "ok",
    "message": "OK",
    "success": true
}
```

#### `GET /v1/minify` — Minify JSON

**Parameters:**
- `json` (query, required, string) — JSON string Example: `{ "a" : 1 }`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/json-api/v1/minify?json=%7B+%22a%22+%3A+1+%7D"
```

**Response:**
```json
{
    "data": {
        "result": "{\"a\":1}",
        "size_bytes": 7,
        "saved_bytes": 4,
        "original_bytes": 11
    },
    "meta": {
        "timestamp": "2026-05-30T09:00:24.399Z",
        "request_id": "276a814d-5015-4274-8fcc-9b7a02ef0ce9"
    },
    "status": "ok",
    "message": "OK",
    "success": true
}
```

#### `GET /v1/validate` — Validate JSON

**Parameters:**
- `json` (query, required, string) — JSON string Example: `{"a":1,"b":[1,2,3]}`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/json-api/v1/validate?json=%7B%22a%22%3A1%2C%22b%22%3A%5B1%2C2%2C3%5D%7D"
```

**Response:**
```json
{
    "data": {
        "keys": 2,
        "type": "object",
        "error": null,
        "valid": true,
        "size_bytes": 19
    },
    "meta": {
        "timestamp": "2026-05-30T09:00:24.449Z",
        "request_id": "0bda1567-e3aa-414a-83d5-71096318a196"
    },
    "status": "ok",
    "message": "OK",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/json-api
OpenAPI spec: https://www.oanor.com/api/json-api/openapi.json
