3
3
4
4
A practical JSON parser written in awk.
5
5
6
- Quick Start
7
- -----------
6
+ Introduction
7
+ ------------
8
8
9
9
JSON.awk is a self-contained, single-file program with no external dependencies.
10
10
It is similar to [ JSON.sh] ( https://github.com/dominictarr/JSON.sh ) , a JSON
@@ -15,51 +15,57 @@ will not find all of JSON.sh features in JSON.awk, and viceversa.
15
15
Features
16
16
--------
17
17
18
+ * Single file without external dependencies
18
19
* JSON.sh compatible output format (as of 2013-03-13)
19
- * Can parse one or multiple input files in a single invocation
20
- * Captures invalid JSON input and processes it on exit
21
- * Written for awk; does not require gawk extensions;
22
- works with mawk 1.3.4 20150503 and higher [ & raquo ; 6 ] ( https://github.com/step-/JSON.awk/issues/6 ) ;
23
- * Single file, does not depend on external programs
24
- * Your choice of MIT or Apache 2 license
20
+ * Can parse one or multiple input files within a single invocation
21
+ * Can be embedded in other awk programs
22
+ * Invalid JSON input is captured and can be processed on exit
23
+ * Written for POSIX awk; does not require GNU gawk extensions ;
24
+ works with mawk 1.3.4 20150503 and higher
25
+ * Choice of MIT or Apache 2 license
25
26
26
27
Supported Platforms
27
28
-------------------
28
29
29
- All OS platforms where a modern implementation of awk is available. Special cases:
30
+ All OS platforms where a POSIX awk implementation is available. Special cases:
30
31
31
32
* FreeBSD [ » ; 10] ( https://github.com/step-/JSON.awk/issues/10 )
32
33
33
34
Setup
34
35
-----
35
36
36
- Just drop the file JSON.awk in your project folder and run it as an awk
37
- script.
37
+ Drop file JSON.awk in your project folder and follow the examples.
38
38
39
39
Usage Examples
40
40
--------------
41
41
42
- For full usage instructions and command-line options please read [ FAQ 1] ( FAQ.md ) .
42
+ For full instructions please [ read the docs] ( doc/usage.md ) .
43
+ If you use mawk please read [ FAQ 6] ( FAQ.md#6 ) .
43
44
44
45
Passing file names as command arguments:
45
46
46
47
``` sh
47
- awk -f JSON.awk file1.json file2.json...
48
+ awk -f JSON.awk file1.json [ file2.json...]
48
49
49
50
awk -f JSON.awk - < file.json
50
51
51
52
cat file.json | awk -f JSON.awk -
52
53
```
53
54
54
55
Passing file names on stdin:
55
- ``` sh
56
- echo -e " file1.json\nfile2.json" > filenames && awk -f JSON.awk < filenames
57
56
57
+ ``` sh
58
58
echo -e " file1.json\nfile2.json" | awk -f JSON.awk
59
59
```
60
60
61
- Projects that use JSON.awk
62
- --------------------------
61
+ Embedded in another awk program ([ FAQ 5] ( FAQ.md#5 ) ):
62
+
63
+ ```
64
+ awk -f your-callbacks.awk -f JSON.awk file.json
65
+ ```
66
+
67
+ Projects known to use JSON.awk
68
+ ------------------------------
63
69
64
70
* [ KindleLauncher] ( https://bitbucket.org/ixtab/kindlelauncher/overview )
65
71
a.k.a. KUAL, an application launcher for the Kindle e-ink models, uses
0 commit comments