CSV ↔ JSON Converter

Convert CSV data to JSON array and JSON to CSV freely.

Result will appear here.

📖 How to Use

1
Enter Data

Paste CSV or JSON data into the input area.

2
Choose Direction

Click CSV → JSON or JSON → CSV to convert.

3
Copy Result

Verify the converted result and click 📋 Copy to save.

💡 Tip: When using the first row as header, CSV converts to an array of objects. Otherwise it converts to a 2D array.

About the CSV / JSON Converter

CSV (Comma-Separated Values) and JSON (JavaScript Object Notation) are the two formats you reach for when tabular data must move between spreadsheets, databases, and APIs. CSV is compact and universally understood by Excel and import wizards; JSON is structured and typed, the native shape of REST payloads and NoSQL documents. This converter bridges the two formats losslessly in either direction, running entirely in your browser so customer lists and production exports never leave your machine.

How it works

The parser follows RFC 4180, the formal CSV specification. A record is a sequence of fields separated by the , delimiter and terminated by a line break (CRLF, \r\n). A field that contains the delimiter, a double quote, or a newline must be wrapped in double quotes; a literal double quote inside a quoted field is escaped by doubling it as "". These rules matter for fields like "Smith, John" or "He said ""hi""", which naive comma splits would corrupt.

During CSV to JSON, the first row is read as the header and every subsequent row becomes a JSON object keyed by those headers. Optional type inference turns values that look like numbers (42, 3.14) or booleans (true) into typed JSON values instead of strings. Going the other way, JSON to CSV flattens each object into a row using the union of keys as the header. Because CSV is tabular while JSON is nested and typed, deeply nested objects are flattened with dot-notation keys or serialized back to a JSON string — a tradeoff worth knowing before you convert.

Common use cases

  • Turning a spreadsheet export into a JSON array for a frontend seed file
  • Feeding a REST API response into a reporting tool that only reads CSV
  • Normalizing inconsistent quoting before a database import
  • Comparing two CSV exports by diffing their normalized JSON form

Worked example

Given this CSV input (note the quoted field with a comma):

name,role
"Ada, B.",admin
"Bob",editor

Converting CSV to JSON (with the first row as header) yields:

[
  { "name": "Ada, B.", "role": "admin" },
  { "name": "Bob", "role": "editor" }
]

The doubled "" and surrounding quotes are unwrapped automatically, so the comma inside "Ada, B." is preserved as data, not mistaken for a delimiter.

Frequently asked questions

Is my CSV or JSON data uploaded anywhere?

No. Parsing, type inference, and re-serialization run locally in your browser through native JavaScript APIs. Your data never leaves your device, so it is safe for customer lists and production exports.

What does RFC 4180 mean for my CSV?

RFC 4180 is the format standard this converter follows: comma delimiter, CRLF line endings, and fields wrapped in double quotes when they contain the delimiter, a quote, or a newline. A literal quote inside a quoted field is escaped by doubling it as two double quotes.

Why are my numbers converted to strings?

CSV stores everything as raw text. With type inference on, the converter detects numbers and booleans; with it off, every value stays a JSON string. Toggle the option for typed values or an exact textual round-trip.

How are nested objects handled when converting JSON to CSV?

CSV is strictly tabular, so nested objects and arrays are flattened into dot-notation keys (for example, address.city) or serialized back to a JSON string inside the cell. Round-tripping deeply nested data through CSV is lossy by design.

What happens if the header row is missing?

When the first row is not used as a header, the converter treats every row identically and emits a JSON array of arrays instead of objects. Each inner array preserves the input column order.

CSV / JSON 변환기란?

CSV(Comma-Separated Values)와 JSON(JavaScript Object Notation)은 표 형태의 데이터를 스프레드시트, 데이터베이스, API 사이에서 옮길 때 가장 먼저 떠올리는 두 형식입니다. CSV는 Excel과 Google Sheets, 데이터베이스 가져오기 마법사가 모두 이해하는 간결한 형식이고, JSON은 구조화되고 타입이 있어 REST 페이로드와 NoSQL 문서의 원래 모습입니다. 이 변환기는 두 형식 사이의 손실 없는 양방향 변환을 브라우저 안에서만 수행하므로 고객 명단이나 운영 데이터가 기기를 떠나지 않습니다.

작동 방식

파서는 공식 CSV 표준인 RFC 4180을 따릅니다. 하나의 레코드는 , 구분자로 나뉜 필드들의 시퀀스이며 줄바꿈(CRLF, \r\n)으로 끝납니다. 구분자, 큰따옴표, 줄바꿈을 포함한 필드는 큰따옴표로 감싸야 하며, 따옴표로 묶인 필드 안의 글자 큰따옴표는 두 개를 연달아 쓴 ""로 이스케이프합니다. 이 규칙은 "Smith, John"이나 "He said ""hi""" 같은 필드에서 중요한데, 단순한 쉼표 분할은 이런 값을 망가뜨리기 때문입니다.

CSV to JSON에서는 첫 행을 헤더로 읽고, 이후의 각 행을 그 헤더를 키로 하는 JSON 객체로 만듭니다. 선택적 타입 추론은 숫자(42, 3.14)나 불리언(true)처럼 보이는 값을 문자열 대신 타입이 있는 JSON 값으로 바꿉니다. 반대 방향인 JSON to CSV에서는 각 객체를 한 행으로 평탄화하며, 키들의 합집합을 헤더로 사용합니다. CSV는 엄격하게 표 형태이고 JSON은 중첩되고 타입이 있으므로, 깊이 중첩된 객체는 점 표기 키로 평탄화되거나 다시 JSON 문자열로 직렬화됩니다 — 변환 전에 알아둘 만한 트레이드오프입니다.

자주 쓰는 경우

  • 스프레드시트 내보내기를 프론트엔드 시드 파일용 JSON 배열로 바꾸기
  • CSV만 읽는 보고 도구에 REST API 응답 넣어 주기
  • 데이터베이스 가져오기 전 일관성 없는 따옴표와 줄바꿈 정규화하기
  • 두 CSV 내보내기를 정규화된 JSON 형태로 비교(diff)하기
  • 테스트 스위트용 표 형태 픽스처 데이터 준비하기

사용 예

다음 CSV 입력(쉼표를 포함한 따옴표 필드 주의)이 주어지면:

name,role
"Ada, B.",admin
"Bob",editor

CSV를 JSON으로 변환(첫 행을 헤더로 사용)하면:

[
  { "name": "Ada, B.", "role": "admin" },
  { "name": "Bob", "role": "editor" }
]

연달아 쓴 ""와 감싼 따옴표는 자동으로 풀리므로, "Ada, B." 안의 쉼표는 구분자로 잘못 해석되지 않고 데이터 그대로 보존됩니다.

자주 묻는 질문

CSV나 JSON 데이터가 외부로 전송되나요?

아닙니다. 파싱, 타입 추론, 재직렬화는 모두 브라우저에서 네이티브 JavaScript API로 로컬에서 처리됩니다. 데이터는 기기를 떠나지 않으므로 고객 명단과 운영 내보내기에도 안전합니다.

RFC 4180이 제 CSV에 어떤 의미인가요?

RFC 4180은 이 변환기가 따르는 형식 표준입니다. 쉼표 구분자, CRLF 줄바꿈, 그리고 구분자나 따옴표, 줄바꿈을 포함한 필드는 큰따옴표로 감쌉니다. 따옴표로 묶인 필드 안의 글자 큰따옴표는 두 개를 연달아 쓴 큰따옴표로 이스케이프합니다.

숫자가 문자열로 변환되는 이유는?

CSV는 모든 값을 날것의 텍스트로 저장합니다. 타입 추론을 켜면 변환기가 숫자와 불리언을 감지하고, 끄면 모든 값이 JSON 문자열로 유지됩니다. 타입이 있는 값이 필요한지, 정확한 텍스트 왕복이 필요한지에 따라 옵션을 선택하세요.

JSON을 CSV로 변환할 때 중첩 객체는 어떻게 되나요?

CSV는 엄격하게 표 형태이므로 중첩 객체와 배열은 점 표기 키(예: address.city)로 평탄화되거나 셀 안에서 다시 JSON 문자열로 직렬화됩니다. 깊이 중첩된 데이터를 CSV로 왕복하는 것은 설계상 손실이 발생합니다.

헤더 행이 없으면 어떻게 되나요?

첫 행을 헤더로 사용하지 않으면 변환기는 모든 행을 동일하게 취급하고 객체 대신 JSON 배열의 배열을 만듭니다. 각 내부 배열은 입력의 열 순서를 그대로 보존합니다.