-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathjsonrange.html
78 lines (76 loc) · 3.17 KB
/
jsonrange.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
<!DOCTYPE html>
<html>
<head>
<title>Caltech Library's Digital Library Development Sandbox</title>
<link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="/css/site.css">
</head>
<body>
<header>
<a href="http://library.caltech.edu"><img src="/assets/liblogo.gif" alt="Caltech Library logo"></a>
</header>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="../">README</a></li>
<li><a href="../LICENSE">LICENSE</a></li>
<li><a href="../INSTALL.html">INSTALL</a></li>
<li><a href="../user-manual.html">User Manual</a></li>
<li><a href="./">Tutorials</a></li>
<li><a href="../search.html">Search Docs</a></li>
<li><a href="../about.html">About</a></li>
<li><a href="https://github.com/caltechlibrary/datatools">GitHub</a></li>
</ul>
</nav>
<section>
<h1 id="using-jsonrange">Using jsonrange</h1>
<p>Working with a map</p>
<pre class="shell"><code> echo '{"name": "Doe, Jane", "email":"[email protected]", "age": 42}' \
| jsonrange</code></pre>
<p>This would yield</p>
<pre><code> name
email
age</code></pre>
<p>Using the -values option on a map</p>
<pre class="shell"><code> echo '{"name": "Doe, Jane", "email":"[email protected]", "age": 42}' \
| jsonrange -values</code></pre>
<p>This would yield</p>
<pre><code> "Doe, Jane"
"[email protected]"
42</code></pre>
<p>Working with an array</p>
<pre class="shell"><code> echo '["one", 2, {"label":"three","value":3}]' | jsonrange</code></pre>
<p>would yield</p>
<pre><code> 0
1
2</code></pre>
<p>Using the -values option on the same array</p>
<pre class="shell"><code> echo '["one", 2, {"label":"three","value":3}]' | jsonrange -values</code></pre>
<p>would yield</p>
<pre><code> one
2
{"label":"three","value":3}</code></pre>
<p>Checking the length of a map or array or number of keys in map</p>
<pre class="shell"><code> echo '["one","two","three"]' | jsonrange -length</code></pre>
<p>would yield</p>
<pre><code> 3</code></pre>
<p>Check for the index value of last element</p>
<pre class="shell"><code> echo '["one","two","three"]' | jsonrange -last</code></pre>
<p>would yield</p>
<pre><code> 2</code></pre>
<p>Limitting the number of items returned</p>
<pre class="shell"><code> echo '[1,2,3,4,5]' | jsonrange -limit 2</code></pre>
<p>would yield</p>
<pre><code> 1
2</code></pre>
</section>
<footer>
<span><h1><A href="http://caltech.edu">Caltech</a></h1></span>
<span>© 2023 <a href="https://www.library.caltech.edu/copyright">Caltech library</a></span>
<address>1200 E California Blvd, Mail Code 1-32, Pasadena, CA 91125-3200</address>
<span>Phone: <a href="tel:+1-626-395-3405">(626)395-3405</a></span>
<span><a href="mailto:[email protected]">Email Us</a></span>
<a class="cl-hide" href="sitemap.xml">Site Map</a>
</footer>
</body>
</html>