This repository has been archived by the owner on Aug 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jsoncols.html
101 lines (80 loc) · 2.95 KB
/
jsoncols.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE html>
<html>
<head>
<title>jsontools -- a small collection of file and shell utilities</title>
<link href="css/site.css" rel="stylesheet" />
<head>
<body>
<header>
<h1>jsontools -- a small collection of file and shell utilities</h1>
</header>
<section><h1>jsoncols</h1>
<p><em>jsoncols</em> was inspired by Stephen Dolan’s <a href="https://github.com/stedolan/jq">jq</a> and
Simeji’s <a href="https://github.com/simeji/jid">jid</a>.</p>
<h2>USAGE</h2>
<pre><code> jsoncols [OPTIONS] [EXPRESSION] [INPUT_FILENAME] [OUTPUT_FILENAME]
</code></pre>
<h2>SYSNOPSIS</h2>
<p><em>jsoncols</em> provides for both interactive exploration of JSON structures like jid
and command line scripting flexibility for data extraction into delimited
columns. This is helpful in flattening content extracted from JSON blobs.
The default delimiter for each value extracted is a comma. This can be
overridden with an option.</p>
<ul>
<li>EXPRESSION can be an empty stirng or dot notation for an object’s path</li>
<li>INPUT_FILENAME is the filename to read or a dash “-” if you want to
explicity read from stdin
<ul>
<li>if not provided then <em>jsoncols</em> reads from stdin</li>
</ul></li>
<li>OUTPUT_FILENAME is the filename to write or a dash “-” if you want to
explicity write to stdout
<ul>
<li>if not provided then <em>jsoncols</em> write to stdout</li>
</ul></li>
</ul>
<h2>OPTIONS</h2>
<pre><code> -d set the delimiter for multi-field output
-h display help
-i run interactively
-l display license
-m display output in monochrome
-v display version
</code></pre>
<h2>EXAMPLES</h2>
<p>If myblob.json contained</p>
<pre><code class="language-json"> {"name": "Doe, Jane", "email":"jane.doe@example.org", "age": 42}
</code></pre>
<p>Getting just the name could be done with</p>
<pre><code class="language-shell"> jsoncols .name myblob.json
</code></pre>
<p>This would yeild</p>
<pre><code class="language-text"> "Doe, Jane"
</code></pre>
<p>Flipping .name and .age into pipe delimited columns is as
easy as listing each field in the expression inside a
space delimited string.</p>
<pre><code class="language-shell"> jsoncols -d\| ".name .age" myblob.json
</code></pre>
<p>This would yeild</p>
<pre><code class="language-text"> "Doe, Jane"|42
</code></pre>
</section>
<nav><ul>
<li><a href="/">home</a></li>
<li><a href="./">jsontools</a></li>
<li><a href="license.html">LICENSE</a></li>
<li><a href="install.html">Install</a></li>
<li><a href="jsoncols.html">jsoncols</a></li>
<li><a href="jsonrange.html">jsonrange</a></li>
<li><a href="xlsx2json.html">xlsx2json</a></li>
<li><a href="xlsx2csv.html">xlsx2csv</a></li>
<li><a href="https://github.com/rsdoiel/jsontools">Github</a></li>
</ul>
</nav>
<footer>
copyright © 2017 R. S. Doiel<br />
see: <a href="license.html">LICENSE</a>
</footer>
</body>
</html>