1
1
# json2csv – Parse JSON files to CSV with data qualifier
2
2
3
+ ![ Go version] [ go_version_img ]
4
+ [ ![ Go report] [ go_report_img ]] [ go_report_url ]
5
+ ![ Code coverage] [ code_coverage_img ]
6
+ [ ![ Wiki] [ wiki_img ]] [ wiki_url ]
7
+ [ ![ License] [ license_img ]] [ license_url ]
8
+
3
9
The parser can read given folder with ` *.json ` files, filtering and
4
10
qualifying input data with intent & stop words dictionaries and save results
5
11
to CSV files by given chunk size.
6
12
7
- Minimal dependency on other Go packages, maximum performance even on large
8
- amounts of input data.
13
+ ** Minimal** dependency on other Go packages, but ** maximum** performance
14
+ even on large amounts of the input JSON data.
9
15
10
16
## ⚡️ Quick start
11
17
12
- Install package:
18
+ First, [ download] [ go_download ] and install ** Go** . Version ` 1.20 ` or higher
19
+ is required.
20
+
21
+ Installation is done by using the [ ` go install ` ] [ go_install ] command:
13
22
14
23
``` bash
15
24
go install https://github.com/koddr/json2csv@latest
16
25
```
17
26
18
- Next, run ` json2csv ` parser:
27
+ Prepare folder with your data source (format ` *.json ` ) and create JSON files
28
+ with:
29
+
30
+ - intents (for ex., ` intents-file.json ` );
31
+ - filter (for ex., ` filter-file.json ` );
32
+
33
+ > 💡 Note: see the [ ` Wiki ` ] [ wiki_url ] page to understand structures of
34
+ > JSON files and get general recommendations for preparing the input data.
35
+
36
+ Next, run ` json2csv ` parser with (or without) options:
19
37
20
38
``` bash
21
39
json2csv \
22
40
-json /path/to/input/json/folder \
23
41
-intents /path/to/intents-file.json \
24
42
-filter /path/to/filter-file.json \
25
43
-output /path/to/output/csv/folder \
26
- -content data \
27
- -min-word-len 5 \
44
+ -content-field message \
45
+ -min-word-len 5 \
28
46
-chunk 1000
29
47
```
30
48
31
- > 💡 Note: output CSV files have a default comma (` , ` ) separators between
32
- > columns.
49
+ > 💡 Note: output CSV file has a default comma (` , ` ) separators between columns.
50
+
51
+ ## 🧩 Options
52
+
53
+ - ` -json [path] ` is an option to set a path to the folder with JSON source
54
+ file(s);
55
+ - ` -intents [path] ` is an option to set a path to the file with intents (see
56
+ [ Wiki] [ wiki_intents_url ] );
57
+ - ` -filter [path] ` is an option to set a path to the file with a filter (see
58
+ [ Wiki] [ wiki_filter_url ] );
59
+ - ` -content-field [string] ` is an option to set a name of the content field
60
+ (attribute that contains string to qualify and filter) in JSON source file(s);
61
+ - ` -min-word-len [int] ` is an option to set a min word length count to filter
62
+ input words (if a word is smaller than this option, it will be skipped);
63
+ - ` -chunk [int] ` is an option to set a chunk size for one CSV file;
33
64
34
65
## ✨ Solving case
35
66
@@ -49,6 +80,21 @@ This is what this Go package solves! ✌️
49
80
50
81
## ⚠️ License
51
82
52
- ` json2csv ` is free and open-source software licensed under the
53
- [ Apache 2.0 License] ( LICENSE ) , created and supported with 🩵 for people and
54
- robots by [ Vic Shóstak] ( https://github.com/koddr ) .
83
+ [ ` json2csv ` ] [ json2csv_url ] is free and open-source software licensed under the
84
+ [ Apache 2.0 License] [ license_url ] , created and supported with 🩵 for people and
85
+ robots by [ Vic Shóstak] [ author ] .
86
+
87
+ [ go_download ] : https://golang.org/dl/
88
+ [ go_install ] : https://golang.org/cmd/go/#hdr-Compile_and_install_packages_and_dependencies
89
+ [ go_version_img ] : https://img.shields.io/badge/Go-1.20+-00ADD8?style=for-the-badge&logo=go
90
+ [ go_report_img ] : https://img.shields.io/badge/Go_report-A+-success?style=for-the-badge&logo=none
91
+ [ go_report_url ] : https://goreportcard.com/report/github.com/koddr/json2csv
92
+ [ code_coverage_img ] : https://img.shields.io/badge/code_coverage-98%25-success?style=for-the-badge&logo=none
93
+ [ wiki_img ] : https://img.shields.io/badge/-wiki_page-blue?style=for-the-badge&logo=wikipedia
94
+ [ wiki_url ] : https://github.com/koddr/json2csv/wiki
95
+ [ wiki_intents_url ] : https://github.com/koddr/json2csv/wiki#intents
96
+ [ wiki_filter_url ] : https://github.com/koddr/json2csv/wiki#filter
97
+ [ license_img ] : https://img.shields.io/badge/license-Apache_2.0-red?style=for-the-badge&logo=none
98
+ [ license_url ] : https://github.com/koddr/json2csv/LICENSE
99
+ [ json2csv_url ] : https://github.com/koddr/json2csv
100
+ [ author ] : https://github.com/koddr
0 commit comments