program:json:json_2_csv
目錄表
online convert
批次轉檔(jsoncsv)
使用 python 下的 jsoncsv 模組進行轉檔
1. 安裝 python-pip
1、首先安裝epel擴充套件源:
$ sudo yum -y install epel-release
2、然後安裝python-pip
$ sudo yum -y install python-pip
2. 安裝 jsoncsv
$ pip install jsoncsv
3. 轉檔
Linux下面的操作命令:
cat raw.json |jsoncsv |mkexcel > output.csv cat raw.json |jsoncsv |mkexcel -t xls > output.xls
Windows下面的操作命令:
!type raw.json |jsoncsv |mkexcel > output.csv !type raw.json |jsoncsv |mkexcel -t xls > output.xls
4. 批次轉檔
for f in *.json; do cat $f | jsoncsv | mkexcel >> output.csv done
批次轉檔(JSON2CSV)
Installation
git clone https://github.com/evidens/json2csv.git cd json2csv pip install -r requirements.txt
Usage
Basic (convert from a JSON file to a CSV file in same path):
python json2csv.py /path/to/json_file.json /path/to/outline_file.json
Specify CSV file
python json2csv.py /path/to/json_file.json /path/to/outline_file.json -o /some/other/file.csv
For MongoDB (multiple JSON objects per file, which is non-standard JSON):
python json2csv.py --each-line /path/to/json_file.json /path/to/outline_file.json
簡易
json2csv json_file.json -o file.csv
如果你想把所有的JSON文件進入一個發現。 csv文件你可以使用
json2csv *.json -o myfile.csv
program/json/json_2_csv.txt · 上一次變更: 2020/05/04 04:32 由 127.0.0.1