CSV to JSON

First row as header; comma separator; quoted fields supported.

{{ csvToJson.message }}

Overview

CSV (Comma-Separated Values) is one of the oldest data formats still in active use — its origins trace back to the 1960s and 1970s, when computers needed a simple way to exchange tabular data between different systems. IBM used variations of this format on its mainframes before any formal standardization. Officially standardized by RFC 4180 in 2005, CSV has outlasted the era of relational databases, XML, JSON, and YAML — and it is still going strong. Every relevant system exports CSV: databases (MySQL, PostgreSQL, SQLite), spreadsheets (Excel, Google Sheets, LibreOffice), BI tools (Tableau, Power BI, Looker), e-commerce systems, ERPs, and CRMs. CSV is the Esperanto of tabular data.

Converting CSV to JSON is necessary when you need to use tabular data in a context that expects JSON: REST APIs, database importers, transformation tools like `jq`, ETL pipelines, or simply when you are building a feature and want realistic test fixtures based on data exported from a real tool. The transformation is conceptually simple — the first CSV row becomes the JSON object keys and each subsequent row becomes an object — but the practical details have traps: fields with commas need quoting, fields with quotes need escaped quotes, and line breaks inside fields are valid per the standard but problematic in simple parsers.

An important caveat is the separator. The name says 'comma', but in practice there is a lot of variation: European countries that use commas as the decimal separator often use semicolons as the CSV field separator — Excel by default generates semicolon-separated CSV under European regional settings. TSV (Tab-Separated Values) files are common in bioinformatics and scientific tools. This tool uses comma as the default separator; if your CSV uses semicolons or tabs, do a find-and-replace before converting, or use the TSV to JSON tool for tab-separated files.

This tool processes CSV entirely in the browser. The first line must be the header row — if your CSV has no header, add a line with column names before converting. Quoted fields are handled correctly, including commas and line breaks inside quotes. The generated JSON is an array of objects where each key corresponds to a header and values are always strings — if you need numbers or booleans, apply a type coercion step in the code that consumes the JSON.

Technical deep dive

Common questions summarized

  • What is this tool for?: It runs fully in your browser: useful to validate, format, or convert data in everyday development.
  • Are my inputs sent to a server?: Processing happens locally with JavaScript. We do not store what you paste into the text areas.
  • Can I use this for real production data?: Use at your own risk. For secrets (passwords, tokens), prefer controlled environments and your company policies. And always review the generated contents. Never trust blindly things you see on the internet.

Sample payload to try

  • See also the larger "Code Snippets" sample; paste this excerpt to try locally: Sample — nome,idade Ana,30 Bob,25

Tool guide

  • What CSV is Text table; the first row is usually the header.

  • What JSON is See the formatter section. The result is usually an array of objects, each row becomes an object with header keys.

  • What the converter does Parses commas and quoted fields and outputs JSON.

  • Why use it Import spreadsheets into code, test parsers, or feed APIs that take JSON from Excel exports.

Code Snippets

Code example
nome,idade
Ana,30
Bob,25

Sample

nome,idade
Ana,30
Bob,25

FAQ

What is this tool for?

It runs fully in your browser: useful to validate, format, or convert data in everyday development.

Are my inputs sent to a server?

Processing happens locally with JavaScript. We do not store what you paste into the text areas.

Can I use this for real production data?

Use at your own risk. For secrets (passwords, tokens), prefer controlled environments and your company policies. And always review the generated contents. Never trust blindly things you see on the internet.