FIRST CH TOOLS / 39 CSV ⇄ JSON
CSV/TSV ⇄ JSON Converter
Paste a spreadsheet export on the left to get a JSON array, or paste an API response on the right to get a table — either side converts as you type. The delimiter is detected for you, column names such as stock.qty become nested objects, and values such as 0123 or a 20-digit ID stay text so that no digits are lost.
Type in either box and it converts instantly
Nothing you paste leaves the browser — the CSV reader and the JSON parser both run on this page, with no external libraries. Loading a file only reads it locally; it is never uploaded. You can also call the tool straight from a URL: /en/csv-json/?csv=a%2Cb%0A1%2C2 or /en/csv-json/?json=%5B%7B%22a%22%3A1%7D%5D&delim=tab
What breaks when a table becomes JSON and back
The delimiter is not always a comma
id;name;price ← Excel in much of Europe writes semicolons id name price ← copying out of a spreadsheet gives you tabs
A file called .csv is often not comma separated. In locales that use a comma as the decimal mark (Germany, France and others) Excel switches the delimiter to a semicolon. This tool looks at the first 20 lines and picks the character that appears the same number of times on every line, then shows what it decided. If that is wrong, pin the delimiter above.
A quote inside a cell is doubled
1,"Chair ""Oslo""",39800 ← the value is Chair "Oslo" 2,"Tokyo, Minato-ku",1000 ← a comma inside quotes is not a delimiter 3,"line one line two",500 ← a line break inside quotes is part of the cell
Under RFC 4180 a value containing the delimiter, a quote or a line break is wrapped in "…", and a literal " is written as "". Backslash escaping (\") is not part of CSV. This tool follows the same rule when writing, quoting only the cells that need it.
Leading zeros disappear once a value becomes a number
zip,tel,code 0150001,09012345678,0123 ← as numbers: 150001 / 9012345678 / 123
Postcodes, phone numbers, invoice numbers and part numbers carry meaning in that leading zero. This tool decides by round trip: a value becomes a number only if converting it back to text gives exactly the original string. Anything else — including +81… and hyphenated numbers — stays a string.
Long IDs lose their last digits
id 12345678901234567890 ← as a JSON number: 12345678901234567000
JSON numbers are IEEE 754 doubles, so integers are exact only up to 2^53 (about 9 quadrillion). Snowflake IDs and similar identifiers are longer than that. This tool keeps them as strings and tells you how many it found.
Excel rewrites dates and exponents on open
SEP1 → 1-Sep the well-known gene-name-to-date accident 1E5 → 100000 read as an exponent 03-04 → 4 March
This happens when the file is opened, not when it is written, and saving again makes the loss permanent. If you hand a CSV to someone, tell them to use Data → From Text/CSV and mark the affected columns as Text.
A cell starting with = can be executed
name,note Yamada,"=1+1" ← opens as 2 in a spreadsheet Tanaka,"=HYPERLINK(...)" ← can be shaped into an outbound request
Dumping form submissions straight into CSV means values that start with =, +, - or @ are read as formulas (CSV injection). This tool counts those cells and lists them in the checks, so you can look before opening a file that came from outside.
Nested JSON does not fit a table as it is
{"id":1,"stock":{"city":"Tokyo","qty":42},"tags":["lighting","brass"]}
id,stock.city,stock.qty,tags.0,tags.1
1,Tokyo,42,lighting,brass
A table has only rows and columns, so nesting is flattened into parent.child column names, and arrays are numbered tags.0, tags.1. The same rule runs in reverse, so going out to CSV and back to JSON restores the original shape. Turn off “expand a.b columns” and nested values are written into one cell as JSON text instead.
Objects with different keys leave gaps
[{"id":1,"name":"A"},{"id":2,"memo":"added later"}]
id,name,memo
1,A,
2,,added later
A JSON array may hold objects with different keys, but a table needs the union of every key as its columns, leaving blanks where a record has nothing. The checks tell you how many records did not match the full set of columns.
BOM and character encoding
EF BB BF id,name… ← how Excel starts a UTF-8 CSV
Excel tries to read a UTF-8 CSV without a BOM using the local legacy encoding, which turns non-ASCII text into mojibake. Turn on “Add a BOM to the CSV” when the file is meant to be opened in Excel. A BOM on the way in is stripped automatically. For Shift_JIS and other legacy encodings, use the Encoding Converter.
Duplicate and empty header names
id,name,name, ← the same name twice, plus a nameless column 1,A,B,C
A JSON object cannot hold the same key twice, so the later column would silently overwrite the earlier one. This tool keeps both by numbering the second one name_2 and says so in the checks. Empty headers are named column4 and so on.
Supported: RFC 4180 CSV (quoting, "" escapes, line breaks inside cells, CRLF/LF), tab / semicolon / pipe separated files, BOM, headerless input, a.b and a[0] nesting, JSON arrays, a single object, an object wrapping an array, and JSON Lines.
How to Use
- Paste into either boxCSV or TSV on the left becomes JSON on the right; JSON on the right becomes a table on the left. Dropping a file works too.
- Say how to read itThe delimiter is detected but can be pinned. Switch the header row, the nesting, the type inference and the BOM to match your data.
- Check and copyRagged rows, duplicate headers, values that would lose digits and cells a spreadsheet would execute all appear under Checks.
About This Tool
CSV and JSON hold the same tabular data in two notations. CSV opens in any spreadsheet but has no nesting and no types; JSON carries structure and types but is awkward to read as a table. This page exists for the moment you need your own data to move between the two — “open this in Excel”, “post this to an API”, “load this as a fixture”.
Nesting travels in the column names. A column called stock.qty becomes {"stock":{"qty":…}}, and tags.0 / tags.1 become an array; tags[0] is read the same way. Because the reverse direction flattens with the same rule, a round trip through CSV returns the original structure. When a name is already taken by a plain value, that column is left flat and reported in the checks.
Type inference is decided by round trip. Plenty of values look numeric yet change when converted: 0123, +1, 1.50, integers past 2^53. Each candidate is converted to a number and back to text, and it is only written as a number when the result is character-for-character identical. That is why postcodes, phone numbers and version strings survive. true, false and null are recognised as well; turn the option off to keep every cell as a string.
Files written by Excel are read as they are: UTF-8 with a BOM, CRLF line endings, quoted cells containing line breaks and "" escapes. Rows with broken quoting are still read — as literal characters — and the lines that look wrong are listed. Being able to read a real-world file and point at the damage is more useful than refusing it on principle.
JSON syntax errors are reported with a line and a column. Browser JSON.parse messages differ between engines, so the parser here is written out in full: it prints the two lines either side of the problem and points at the column with ^. Input that is not an array (a single object, or {"data":[…]} wrapping one) and JSON Lines are both accepted.
Related tools: JSON ⇄ YAML for configuration files, Markdown Table for pasting a table into documentation, Test Data Generator for making rows from scratch, and Encoding Converter for character encodings. This page is for moving data you already have from one notation to the other.
From AI Agents
This conversion logic is also available as the csv_convert tool of the @first-ch/tools-mcp MCP (Model Context Protocol) server, so an AI agent can call it without a browser. It reads and writes files by path, which makes it a natural first step before processing a spreadsheet export. See For AI Agents for setup.
Install
claude mcp add firstch-tools -- npx -y @first-ch/tools-mcp
Examples
# CSV to a JSON array (delimiter detected, types inferred) csv_convert(text="id,name\n1,Alice\n2,Bob") # Read a CSV file and write the JSON next to it csv_convert(path="/tmp/orders.csv", outputPath="/tmp/orders.json") # JSON to a CSV for Excel (BOM, CRLF) csv_convert(direction="json2csv", path="/tmp/items.json", outputPath="/tmp/items.csv", bom=true, newline="crlf") # TSV with no header row and no type inference csv_convert(text="1\t2\n3\t4", delimiter="tab", header=false, types=false)
Other Tools
- 01WebP Converter画像→WebP一括変換
- 02White BG Remover白背景の透過
- 03Contrast Checkerコントラスト比チェッカー
- 04Character Counter文字数カウント
- 05llms.txt Generatorllms.txt ジェネレーター
- 06JSON-LD GeneratorJSON-LD構造化データ生成
- 07Markdown → PDFMarkdown→PDF変換
- 08OGP Meta Tag WizardOGPメタタグ生成ウィザード
- 09Favicon Generatorfaviconジェネレーター
- 10TikTok PublisherTikTok投稿ツール
- 11Encoding Converter文字コード・改行コード変換
- 12AVIF Converter画像→AVIF変換+picture生成
- 13Test Data Generatorテストデータ生成
- 14Marp Markdown → SlidesMarp Markdown→スライド
- 15Text & Code Diff Checkerテキスト・コード差分チェッカー
- 16Cron ExplainerCron式ビジュアル解説&発火日時
- 17Base64 & Data URIBase64 & Data URI変換
- 18URL Parameters & UTMURLパラメータ分解・UTMタグ編集
- 19HTML Escape & UnescapeHTMLエンティティ・特殊文字エスケープ
- 20JSON ⇄ YAML ConverterJSON ⇄ YAML 相互変換&整形
- 21PX ⇄ REM / EM ConverterPX ⇄ REM / EM 単位変換
- 22Color Converter & AlphaColorコード変換&アルファ透過
- 23Hash GeneratorMD5 / SHA-256 ハッシュ生成
- 24JWT Decoder & ExpiryJWTデコーダー&有効期限チェック
- 25User-Agent ParserUser-Agent 解析&デバイス判定
- 26UUID & ULID GeneratorUUID & ULID 一括生成
- 27Aspect Ratio Calculatorアスペクト比計算&サイズ算出
- 28Markdown Table & CSV/TSV ConverterMarkdownテーブル整形&CSV/TSV変換
- 29SQL Query FormatterSQLクエリフォーマッター&整形
- 30QR Code GeneratorQR Code Generator
- 31Regex Tester正規表現テスター
- 32Unix Timestamp ConverterUNIXタイムスタンプ⇄日時変換
- 33New Tab Memo — Chrome Extension新規タブメモ帳 Chrome拡張
- 34Image Resizer & Cropper画像リサイズ&クロップ
- 35EXIF Viewer & RemoverEXIF情報の確認&除去
- 36robots.txt Generatorrobots.txt ジェネレーター
- 37Secure Password Generator安全なパスワード生成
- 38Case Converter文字列ケース変換