CSV to JSON API

Convert CSV into an array of JSON objects using the header row, with delimiter auto-detection, number and boolean typing, and row-level errors.

POSThttps://apibox.io.vn/v1/csv-to-json

Send CSV text in the csv field or as a raw text/csv / text/plain body. By default the first row is used as header and each following row becomes an object (rows), with fields listing the column names. Set header=false to get arrays of values instead.

The delimiter (comma, semicolon, tab, pipe...) is detected automatically, or forced with delimiter. Numbers and booleans are converted to JSON types (dynamic_typing, on by default); set dynamic_typing=false to keep every value as a string. Quoted fields with commas and line breaks are handled, and empty lines are skipped.

The response also includes row_count, the delimiter used and up to 50 parse errors (row, message, code), such as rows with too few fields. The request body is limited to 5 MB.

Parameters

NameInTypeRequiredDefault
csvbodystringyesCSV text. Can also be sent as a raw text/csv or text/plain body.
headerbody|querybooleannotrueUse the first row as column names and return objects.
delimiterbody|querystringnoField delimiter; auto-detected when empty.
dynamic_typingbody|querybooleannotrueConvert numbers and booleans to JSON types.

Example

curl -X POST "https://apibox.io.vn/v1/csv-to-json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"csv":"name,age,city\nAlice,30,Hanoi\nBob,25,\"Ho Chi Minh City\""}'

Response

{
  "rows": [
    {
      "name": "Alice",
      "age": 30,
      "city": "Hanoi"
    },
    {
      "name": "Bob",
      "age": 25,
      "city": "Ho Chi Minh City"
    }
  ],
  "row_count": 2,
  "fields": [
    "name",
    "age",
    "city"
  ],
  "delimiter": ",",
  "errors": []
}

Use cases

  • Import spreadsheet exports (Excel, Google Sheets) into an app
  • Turn CSV reports into JSON for a frontend or chart library
  • Load CSV seed data into a NoSQL database
  • Validate CSV uploads and report broken rows to users

FAQ

Is the delimiter detected automatically?

Yes. Comma, semicolon, tab and other common delimiters are detected; use delimiter to force one.

Are numbers converted or kept as strings?

Numbers and booleans are converted by default. Send dynamic_typing=false to keep all values as strings (useful for zip codes or IDs with leading zeros).

What if my CSV has no header row?

Set header=false; each row is then returned as an array and fields is null.

Related APIs

Start with 1,000 free requests every month. Get free API key →