22jsoncsv : easily convert json to csv or xls[x]
33==============================================
44
5- .. image :: https://img.shields.io/pypi/v/jsoncsv.svg
5+ |pypi | |build | |coverage |
6+
7+ .. |pypi | image :: https://img.shields.io/pypi/v/jsoncsv.svg
68 :target: https://pypi.python.org/pypi/jsoncsv
79
8- .. image :: https://api.travis-ci.org/alingse/jsoncsv.svg?branch=master
10+ .. | build | image :: https://api.travis-ci.org/alingse/jsoncsv.svg?branch=master
911
10- .. image :: https://coveralls.io/repos/github/alingse/jsoncsv/badge.svg
12+ .. | coverage | image :: https://coveralls.io/repos/github/alingse/jsoncsv/badge.svg
1113 :target: https://coveralls.io/github/alingse/jsoncsv
1214
1315
@@ -20,41 +22,58 @@ Just use them.
2022Quick Start :
2123=================
2224
23- cat the raw.json to csv/xls use command line tool
25+ Cat the raw.json to csv/xls use command line tool
2426
2527.. code-block :: bash
2628
2729 cat raw.json | jsoncsv | mkexcel > output.csv
2830 cat raw.json | jsoncsv | mkexcel -t xls > output.xls
2931
30- make sure each line of raw json text file is a json object
32+ Each line of raw json text file is a json object
3133
32- .. code-block :: bash
34+ .. code-block :: json
3335
34- $cat raw.json
3536 {"id" :1 , "name" :" A" , "year" : 2015 }
3637 {"id" :2 , "name" :" S" , "zone" : " china" }
37- $cat raw.json | jsoncsv | mkexcel > output.csv
38- $cat output.csv
38+
39+ Jsoncsv will output a csv file
40+
41+ .. code-block ::
42+
3943 id,name,year,zone
4044 1,A,2015,
4145 2,S,,china
4246
4347 This is easily and needn't care the different keys from any two object.
4448
45- if input file is an json_array, use `-A/--array ` to decode it
49+ For Json Array
50+ -------------------
51+
52+ If input file is an json_array, use `-A/--array ` to decode it
4653
4754.. code-block :: bash
4855
49- $cat raw.json
50- [{" id" :1, " name" :" A" , " year" : 2015}, {" id" :2, " name" :" S" , " zone" : " china" }]
51- $cat raw.json | jsoncsv -A | mkexcel > output.csv
52- $cat output.csv
56+ cat raw.json | jsoncsv -A | mkexcel > output.csv
57+
58+ **Input File **
59+
60+ .. code-block :: json
61+
62+ [
63+ {"id" :1 , "name" :" A" , "year" : 2015 },
64+ {"id" :2 , "name" :" S" , "zone" : " china" }
65+ ]
66+
67+ **Output File **
68+
69+ .. code-block ::
70+
5371 id,name,year,zone
5472 1,A,2015,
5573 2,S,,china
5674
57- another way to convert file step by step
75+ Step by Step
76+ ---------------------------
5877
5978.. code-block :: bash
6079
0 commit comments