Skip to content

Commit a8e56ab

Browse files
committed
updated docs
1 parent 4385d62 commit a8e56ab

File tree

6 files changed

+140
-4
lines changed

6 files changed

+140
-4
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ shelltools which are utilities useful for shell scripting.
1212
+ [csv2mdtable](docs/csv2mdtable.html) - a tool to render CSV as a Github Flavored Markdown table
1313
+ [csv2xlsx](docs/csv2xlsx.html) - a tool to take a CSV file and add it as a sheet to a Excel Workbook file.
1414
+ [jsoncols](docs/jsoncols.html) - a tool for exploring and extracting JSON values into columns
15-
+ [jsonrange](docs/jsonrange.html) - a tool for iterating for JSON maps and arrays
15+
+ [jsonjoin](docs/jsonjoin.html) - a tool for joining JSON object documents
1616
+ [jsonmunge](docs/jsonmunge.html) - a tool to transform JSON documents into something else
17+
+ [jsonrange](docs/jsonrange.html) - a tool for iterating for JSON maps and arrays
1718
+ [vcard2json](docs/vcard2json.html) - an experimental tool to convert vCards to JSON
1819
+ [xlsx2json](docs/xlsx2json.html) - a tool for converting Excel Workbooks to JSON files
1920
+ [xlsx2csv](docs/xlsx2csv.html) - a tool for converting Excel Workbooks sheets to a CSV file(s)

docs/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ <h1>datatools command help</h1>
3434
<li><a href="index.html">index</a></li>
3535
<li><a href="jsoncols.html">jsoncols</a></li>
3636
<li><a href="jsonmunge.html">jsonmunge</a></li>
37+
<li><a href="jsonjoin.html">jsonjoin</a></li>
3738
<li><a href="jsonrange.html">jsonrange</a></li>
3839
<li><a href="mergepath.html">mergepath</a></li>
3940
<li><a href="range.html">range</a></li>

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
+ [index](index.html)
1313
+ [jsoncols](jsoncols.html)
1414
+ [jsonmunge](jsonmunge.html)
15+
+ [jsonjoin](jsonjoin.html)
1516
+ [jsonrange](jsonrange.html)
1617
+ [mergepath](mergepath.html)
1718
+ [range](range.html)

docs/jsonjoin.html

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Caltech Library's Digital Library Development Sandbox</title>
5+
<link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
6+
<link rel="stylesheet" href="/css/site.css">
7+
</head>
8+
<body>
9+
<header>
10+
<a href="http://library.caltech.edu"><img src="/assets/liblogo.gif" alt="Caltech Library logo"></a>
11+
</header>
12+
<nav>
13+
<ul>
14+
<li><a href="/">Home</a></li>
15+
<li><a href="../">up</a></li>
16+
<li><a href="./">Documentation</a></li>
17+
<li><a href="../how-to/">How To &hellip;</a></li>
18+
</ul>
19+
20+
</nav>
21+
22+
<section>
23+
<h1>USAGE</h1>
24+
25+
<h2>jsonjoin [OPTIONS] JSON_FILE_1 JSON_FILE_2</h2>
26+
27+
<h2>SYSNOPSIS</h2>
28+
29+
<p>jsonjoin is a command line tool that takes two (or more) JSON object
30+
documents and combines into a new JSON object document based on
31+
the options chosen.</p>
32+
33+
<h2>OPTIONS</h2>
34+
35+
<pre><code>-h display help
36+
-help display help
37+
-l display license
38+
-license display license
39+
-o output filename
40+
-output output filename
41+
-overwrite copy all key/values from second object into the first
42+
-update copy unique key/values from second object into the first
43+
-v display version
44+
-version display version
45+
</code></pre>
46+
47+
<h2>EXAMPLES</h2>
48+
49+
<h3>Joining two JSON objects (maps)</h3>
50+
51+
<p>person.json containes</p>
52+
53+
<pre><code class="language-json"> {&quot;name&quot;: &quot;Doe, Jane&quot;, &quot;email&quot;:&quot;[email protected]&quot;, &quot;age&quot;: 42}
54+
</code></pre>
55+
56+
<p>profile.json containes</p>
57+
58+
<pre><code class="language-json"> {&quot;name&quot;: &quot;Doe, Jane&quot;, &quot;bio&quot;: &quot;World renowned geophysist.&quot;,
59+
&quot;email&quot;: &quot;[email protected]&quot;}
60+
</code></pre>
61+
62+
<p>A simple join of person.json with profile.json</p>
63+
64+
<pre><code class="language-shell"> jsonjoin person.json profile.json
65+
</code></pre>
66+
67+
<p>would yeild</p>
68+
69+
<pre><code class="language-json"> {
70+
&quot;person&quot;: {&quot;name&quot;: &quot;Doe, Jane&quot;, &quot;email&quot;:&quot;[email protected]&quot;, &quot;age&quot;: 42},
71+
&quot;profile&quot;: {&quot;name&quot;: &quot;Doe, Jane&quot;, &quot;bio&quot;: &quot;World renowned geophysist.&quot;,
72+
&quot;email&quot;: &quot;[email protected]&quot;}
73+
}
74+
</code></pre>
75+
76+
<p>You can modify this behavor with -add or -merge. Both options are
77+
order dependant (i.e. not guaranteed to be associative, A add B does
78+
not necessarily equal B add A).</p>
79+
80+
<ul>
81+
<li>-update will add unique key/values from the second object to the first object</li>
82+
<li>-overwrite replace key/values in first object one with second objects&rsquo;</li>
83+
</ul>
84+
85+
<p>Running</p>
86+
87+
<pre><code class="language-shell"> jsonjoin -update person.json profile.json
88+
</code></pre>
89+
90+
<p>would yield</p>
91+
92+
<pre><code class="language-json"> { &quot;name&quot;: &quot;Doe, Jane&quot;, &quot;email&quot;:&quot;[email protected]&quot;, &quot;age&quot;: 42,
93+
&quot;bio&quot;: &quot;World renowned geophysist.&quot; }
94+
</code></pre>
95+
96+
<p>Running</p>
97+
98+
<pre><code class="language-shell"> jsonjoin -update profile.json person.json
99+
</code></pre>
100+
101+
<p>would yield</p>
102+
103+
<pre><code class="language-json"> { &quot;name&quot;: &quot;Doe, Jane&quot;, &quot;age&quot;: 42,
104+
&quot;bio&quot;: &quot;World renowned geophysist.&quot;,
105+
&quot;email&quot;: &quot;[email protected]&quot; }
106+
</code></pre>
107+
108+
<p>Running</p>
109+
110+
<pre><code class="language-shell"> jsonjoin -overwrite person.json profile.json
111+
</code></pre>
112+
113+
<p>would yield</p>
114+
115+
<pre><code class="language-json"> { &quot;name&quot;: &quot;Doe, Jane&quot;, &quot;email&quot;:&quot;[email protected]&quot;, &quot;age&quot;: 42,
116+
&quot;bio&quot;: &quot;World renowned geophysist.&quot; }
117+
</code></pre>
118+
119+
<p>jsonjoin v0.0.12</p>
120+
121+
</section>
122+
123+
<footer>
124+
<span><h1><A href="http://caltech.edu">Caltech</a></h1></span>
125+
<span>&copy; 2017 <a href="https://www.library.caltech.edu/copyright">Caltech library</a></span>
126+
<address>1200 E California Blvd, Mail Code 1-32, Pasadena, CA 91125-3200</address>
127+
<span>Phone: <a href="tel:+1-626-395-3405">(626)395-3405</a></span>
128+
<span><a href="mailto:[email protected]">Email Us</a></span>
129+
<a class="cl-hide" href="sitemap.xml">Site Map</a>
130+
</footer>
131+
</body>
132+
</html>

index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ <h1>datatools</h1>
3737
<li><a href="docs/csv2mdtable.html">csv2mdtable</a> - a tool to render CSV as a Github Flavored Markdown table</li>
3838
<li><a href="docs/csv2xlsx.html">csv2xlsx</a> - a tool to take a CSV file and add it as a sheet to a Excel Workbook file.</li>
3939
<li><a href="docs/jsoncols.html">jsoncols</a> - a tool for exploring and extracting JSON values into columns</li>
40-
<li><a href="docs/jsonrange.html">jsonrange</a> - a tool for iterating for JSON maps and arrays</li>
40+
<li><a href="docs/jsonjoin.html">jsonjoin</a> - a tool for joining JSON object documents</li>
4141
<li><a href="docs/jsonmunge.html">jsonmunge</a> - a tool to transform JSON documents into something else</li>
42+
<li><a href="docs/jsonrange.html">jsonrange</a> - a tool for iterating for JSON maps and arrays</li>
4243
<li><a href="docs/vcard2json.html">vcard2json</a> - an experimental tool to convert vCards to JSON</li>
4344
<li><a href="docs/xlsx2json.html">xlsx2json</a> - a tool for converting Excel Workbooks to JSON files</li>
4445
<li><a href="docs/xlsx2csv.html">xlsx2csv</a> - a tool for converting Excel Workbooks sheets to a CSV file(s)</li>

mk-website.bash

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ cat <<EOF2 >docs/index.md
6161
EOF2
6262

6363
# Generate the index for command docuumentation pages
64-
for FNAME in csv2json csv2mdtable csv2xlsx csvcols csvfind csvjoin finddir findfile index jsoncols jsonmunge jsonrange mergepath range reldate timefmt urlparse vcard2json xlsx2csv xlsx2json; do
64+
for FNAME in csv2json csv2mdtable csv2xlsx csvcols csvfind csvjoin finddir findfile index jsoncols jsonmunge jsonjoin jsonrange mergepath range reldate timefmt urlparse vcard2json xlsx2csv xlsx2json; do
6565
echo "+ [$FNAME](${FNAME}.html)"
6666
done >>docs/index.md
6767
git add docs/index.md
6868

6969
# Generate the individual command docuumentation pages
70-
for FNAME in csv2json csv2mdtable csv2xlsx csvcols csvfind csvjoin finddir findfile index jsoncols jsonmunge jsonrange mergepath range reldate timefmt urlparse vcard2json xlsx2csv xlsx2json; do
70+
for FNAME in csv2json csv2mdtable csv2xlsx csvcols csvfind csvjoin finddir findfile index jsoncols jsonmunge jsonjoin jsonrange mergepath range reldate timefmt urlparse vcard2json xlsx2csv xlsx2json; do
7171
echo "Generating docs/$FNAME.html"
7272
MakePage docs/nav.md "docs/$FNAME.md" "docs/$FNAME.html"
7373
done

0 commit comments

Comments
 (0)