# CSV JSON converter

> Convert CSV to JSON and JSON back to CSV, with a delimiter and a header row you choose.

Free CSV to JSON and JSON to CSV converter. Pick a comma, tab, semicolon, or pipe, or let the first row decide. Keep or drop the header, infer booleans and numbers, and flatten nested JSON into dotted columns. It runs in the browser.

- Page: https://benchline.fabwaseem.com/t/csv-json-convert
- Runs: in the browser. Input stays on the device.
- Price: free, no account
- Input: CSV or JSON text, a delimiter, a header toggle, and type inference or nested flattening.
- Output: Pretty JSON, or CSV using the delimiter you picked, plus the row and column counts.
- Keywords: csv to json, json to csv, csv converter
- Updated: 2026-10-18
- Built by: Waseem Anjum (https://fabwaseem.com)

## How to use it

1. **Choose a direction.** CSV to JSON reads a table. JSON to CSV writes one. The sample in each direction shows the shape that works.
2. **Set the delimiter and header.** Auto detects the delimiter from the first record. Turn the header off for a grid with no names.
3. **Copy the result.** Inferred types and flattened columns are applied before the output is shown. An unclosed quote is reported instead of a partial table.

## Use it from an AI agent

MCP tool name: `convert_csv_json`
MCP endpoint: https://benchline.fabwaseem.com/mcp (Streamable HTTP, no key)
HTTP: POST https://benchline.fabwaseem.com/api/v1/tools/csv-json-convert with the input as the JSON body
This call does not fetch anything. It runs on the arguments you send.

Convert CSV to JSON or JSON to CSV. Supports comma, tab, semicolon, and pipe delimiters, an optional header, type inference, and dotted flattening. Inferred numbers that do not fit in a JavaScript number keep their digits.

### Input schema

```json
{
  "type": "object",
  "properties": {
    "text": {
      "type": "string"
    },
    "direction": {
      "default": "csv-to-json",
      "type": "string",
      "enum": [
        "csv-to-json",
        "json-to-csv"
      ]
    },
    "delimiter": {
      "default": "auto",
      "description": "Comma, tab, semicolon, pipe, or auto. Auto is a comma when writing CSV.",
      "type": "string",
      "enum": [
        "auto",
        ",",
        "\t",
        ";",
        "|"
      ]
    },
    "header": {
      "default": true,
      "type": "boolean"
    },
    "inferTypes": {
      "default": true,
      "description": "Used when converting CSV to JSON.",
      "type": "boolean"
    },
    "flatten": {
      "default": false,
      "description": "Used when converting JSON to CSV. Nested keys become dotted columns.",
      "type": "boolean"
    }
  },
  "required": [
    "text",
    "direction",
    "delimiter",
    "header",
    "inferTypes",
    "flatten"
  ],
  "additionalProperties": false
}
```

### Example tools/call

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "convert_csv_json",
    "arguments": {
      "text": "example",
      "direction": "csv-to-json",
      "delimiter": "auto",
      "header": true,
      "inferTypes": true,
      "flatten": false
    }
  }
}
```

Setup for Claude, Cursor, and VS Code: https://benchline.fabwaseem.com/mcp/guide

## Questions

### Which delimiters work?

Comma, tab, semicolon, and pipe. Auto counts separators outside quotes on the first record and uses the most common one. A tie stays a comma.

### What does the header option do?

With a header, the first CSV row becomes object keys and JSON objects become a header row. Without it, CSV becomes arrays of cells and JSON arrays of arrays are written as rows with no header.

### Which values are inferred?

true, false, null, and plain numbers, in either case for the words. A leading zero such as a ZIP code stays a string. A number that does not fit in a JavaScript number keeps the digits from the cell. Turn inference off to keep every cell a string.

### How are nested objects written to CSV?

Flatten joins keys with dots, so address.city becomes a column. Leave it off and the nested value is a JSON string in one cell.

## Related tools

- [JSON formatter](https://benchline.fabwaseem.com/t/json-formatter): Pretty-print, minify, and validate JSON, with the exact line and column when it fails.
- [JSON YAML converter](https://benchline.fabwaseem.com/t/json-yaml-convert): Convert JSON, YAML, TOML, and XML in the browser, and keep the line number when a document fails.
- [Diff checker](https://benchline.fabwaseem.com/t/diff-checker): Compare two texts side by side or inline, and download a unified patch.
- [Base64 codec](https://benchline.fabwaseem.com/t/base64-codec): Encode and decode Base64 for text or a file, including the URL-safe alphabet.
