Skip to content

Commit efcf5ff

Browse files
committed
s
1 parent 3b5ef8f commit efcf5ff

1 file changed

Lines changed: 37 additions & 32 deletions

File tree

README.rst

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,50 +11,62 @@ jsoncsv : easily convert json to csv or xls[x]
1111
:target: https://coveralls.io/github/alingse/jsoncsv
1212

1313

14-
jsoncsv && mkexcel is a command tool to convert json file to csv/xlsx file.
14+
jsoncsv (with `mkexcel`) is a command tool to convert json file to csv/xlsx file.
1515

16-
It's simple, and no need user to specify the keys. :)
16+
It's simple, and no need user to specify the keys.
17+
18+
Just use them.
1719

1820
Quick Start :
1921
=================
2022

2123
cat the raw.json to csv/xls use command line tool
2224

23-
each line of raw json text file is a json object.
25+
.. code-block:: bash
26+
27+
cat raw.json| jsoncsv | mkexcel > output.csv
28+
cat raw.json| jsoncsv | mkexcel -t xls > output.xls
29+
30+
make sure each line of raw json text file is a json object
2431

2532
.. code-block:: bash
2633
27-
# raw json text,(each line is a json object)
28-
# {"id":1, "name":"A"}
29-
# {"id":2, "name":"S"}
30-
cat raw.json | jsoncsv | mkexcel > output.csv
31-
cat raw.json | jsoncsv | mkexcel -t xls > output.xls
34+
$cat raw.json
35+
{"id":1, "name":"A", "year": 2015}
36+
{"id":2, "name":"S", "zone": "china"}
37+
$cat raw.json | jsoncsv | mkexcel > output.csv
38+
$cat output.csv
39+
id,name,year,zone
40+
1,A,2015,
41+
2,S,,china
3242
33-
a another example
43+
This is easily and needn't care the different keys from any two object.
44+
45+
if input file is an json_array, use `-A/--array` to decode it
3446

3547
.. code-block:: bash
3648
37-
echo '{"user":{"id":1,"name":"A"},"week":52}\n{"user":{"id":1,"name":"S"}, "year":2015}'|jsoncsv
38-
# {"user.id": 1, "user.name": "A", "week": 52}
39-
# {"user.id": 1, "user.name": "S", "year": 2015}
40-
echo '{"user":{"id":1,"name":"A"},"week":52}\n{"user":{"id":1,"name":"S"}, "year":2015}'|jsoncsv|mkexcel
41-
# user.id,user.name,week,year
42-
# 1,A,52,
43-
# 1,S,,2015
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
53+
id,name,year,zone
54+
1,A,2015,
55+
2,S,,china
4456
45-
or
57+
another way to convert file step by step
4658

4759
.. code-block:: bash
4860
49-
jsoncsv raw.json expand.json
50-
mkexcel expand.json -t xls output.xls
61+
$jsoncsv raw.json expand.json
62+
$mkexcel expand.json -t xls output.xls
5163
52-
more options see `--help`.
64+
get more options with `--help`.
5365

5466
.. code-block:: bash
5567
5668
jsoncsv --help
57-
mkexcel --help
69+
mkexcel --help
5870
5971
Install
6072
================
@@ -66,6 +78,9 @@ Install
6678
6779
Usage
6880
=================
81+
82+
see #QuickStart and get more options with `--help`.
83+
6984
just expand/restore the json, the expand json is one layer json.
7085

7186
.. code-block:: bash
@@ -82,16 +97,6 @@ mkexcel the expanded json (one layer)
8297
mkexcel -t xls expand.json > output.xls
8398
mkexcel -t csv expand.json > output.csv
8499
85-
86-
jsoncsv
87-
>>>>>>>>
88-
89-
use jsoncsv to expand json files to 1 layer json
90-
91-
.. code-block:: bash
92-
93-
jsoncsv raw.json expand.json
94-
95100
-e, --expand
96101
-------------
97102

@@ -179,7 +184,7 @@ example:
179184
2. mkexcel enable hooks
180185
-----------------------------------------
181186
182-
wait next version
187+
wait next next version
183188
184189
185190
3. unicodecsv is not good enough

0 commit comments

Comments
 (0)