11
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

csv を json に変換する PowerShell ワンライナー

Last updated at Posted at 2021-02-26

あらかじめ json に変換したい csv ファイルの文字コードをShift-JISまたはUTF-8 with BOMにしておくこと。

2021-06-17 追記:入力ファイルの文字コードを指定することで文字化けを回避できるようになりました。

CSVファイルがShift_JISの場合
gc .\input.csv | ConvertFrom-Csv | ConvertTo-Json > output.json
CSVファイルがUTF8の場合
gc -Encoding UTF8 .\input.csv | ConvertFrom-Csv | ConvertTo-Json > output.json
11
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?