CSVをJSONに変換する方法(無料)
- 選ぶ
- 貼る
- コピーする
表計算のデータを、プログラムやWebサービスで使いたい。逆に、JSONのデータを、表で見たい。CSVとJSONを相互変換する は、CSVとJSONを相互に変換するツールです。貼り付けた内容は、この端末の中で変換します。どこにも送られません。
手順(CSV → JSON)
- 「変換の向き」で、「CSV → JSON」を選びます。
- 「区切り文字(CSV)」を選びます(カンマ・タブ・セミコロン)。
- 「変換前」に、CSVを貼り付けます。
- 必要なら、「1行目を見出しとして使う(CSV → JSON)」にチェックを入れます。
- 「変換する」を押します。
- 「変換後」に結果が出ます。「結果をコピー」か「ファイルで保存」で使います。
CSVとJSONとは
- CSV:カンマなどで区切った、表のデータ。Excelで開ける。
- JSON:プログラムでよく使われる、データの書き方。「項目名: 値」の形で書く。
変換の例
CSV:
名前,年齢
山田,30
佐藤,25
JSON(1行目を見出しにした場合):項目名「名前」「年齢」を持つデータが、2件並ぶ形になります。
向いている場面
- Excelのデータを、Webアプリやプログラムに渡す
- APIの結果(JSON)を、表で確認する
- 設定ファイルの、形式を変える
- データの形式を、学習用に確かめる
便利な機能
- 「結果を入力に戻す」:結果を、そのまま次の変換の入力にできる。
- 「結果をコピー」:結果をコピーする。
- 「ファイルで保存」:ファイルとして保存する。
例
Excelで作った商品リストを、Webサイトのデータとして使いたかった。CSVにして貼り付け、JSONに変換。1行目を見出しにして、きれいに変換できた。
つまずきやすい点
- 文字化けする:貼り付け元の文字コードや、環境を確認する。
- 区切り文字が合っていない:データに合わせて、選び直す。
- 変換できない:JSONの書き方(かっこ、カンマ)を確認する。
よくある質問
大きなデータでも変換できますか?
端末のメモリが許す範囲で変換できます。非常に大きなデータは、分けて変換してください。
貼り付けたデータは、送られますか?
いいえ。ブラウザの中で変換します。
まとめ
向きを選び、貼り付けて、「変換する」。見出しの扱いと区切り文字に気をつけましょう。
CSVとJSONを相互変換するを使う(無料)あわせて使えるツール
- 重複した行を消す・並べ替える:重複した行を消して、並べ替えます。
- ファイルをZIPにまとめる:複数のファイルを、1つのZIPにまとめます。
- 文字数カウント(エントリーシート・レポート用):文章の文字数・行数・原稿用紙の枚数などを数えます。
同じツールの、ほかの解説
How to Convert CSV to JSON (Free)
- Choose
- Paste
- Copy
You want to use spreadsheet data in a program or web service. Or conversely, view JSON data as a table. Convert CSV and JSON converts between CSV and JSON. What you paste is converted inside this device and sent nowhere.
Steps (CSV → JSON)
- For "Direction", choose "CSV → JSON".
- Choose the "Delimiter (CSV)" (comma, tab or semicolon).
- Paste the CSV into "Before conversion".
- If needed, tick "Use the first row as headings (CSV → JSON)".
- Press "Convert".
- The result appears under "After conversion". Use it with "Copy result" or "Save as file".
What CSV and JSON are
- CSV: table data separated by commas and so on. Can be opened in Excel.
- JSON: a way of writing data often used in programs. Written in the form "name: value".
Conversion example
CSV:
name,age
Yamada,30
Sato,25
JSON (with the first row as headings): two records, each with the items "name" and "age", lined up.
Good for
- Passing Excel data to a web app or program
- Viewing API results (JSON) as a table
- Changing the format of a configuration file
- Checking data formats for learning
Handy features
- "Put result back in input": use the result directly as the input for the next conversion.
- "Copy result": copies the result.
- "Save as file": saves it as a file.
Example
Wanted to use a product list made in Excel as data for a website. Pasted it as CSV and converted to JSON. With the first row as headings it converted cleanly.
Common stumbling blocks
- Garbled characters: check the encoding and environment of where you pasted from.
- Wrong delimiter: choose again to match the data.
- Cannot convert: check the JSON syntax (brackets, commas).
Frequently asked questions
Can large data be converted?
Within what the device's memory allows. Convert very large data in parts.
Is the pasted data sent?
No. It is converted inside the browser.
Summary
Choose the direction, paste and press "Convert". Mind the handling of headings and the delimiter.
Use "Convert CSV and JSON" (free)Tools that go well with this
- Remove Duplicate Lines and Sort a List: Remove duplicate lines and sort them.
- Make a ZIP File: Pack several files into one ZIP.
- Character Counter (for Applications and Reports): Count characters, lines and manuscript sheets of your text.