Skip to content

Commit 5608f43

Browse files
committed
Merge branch 'develop'
2 parents 17c6e25 + 29bdb5c commit 5608f43

File tree

14 files changed

+944
-281
lines changed

14 files changed

+944
-281
lines changed

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Try it out on the online playground: <https://jsonquerylang.org>
1010

1111
## Features
1212

13-
- Small: just `3.0 kB` when minified and gzipped! The JSON query engine without parse/stringify is only `1.4 kB`.
14-
- Feature rich (40+ powerful functions)
13+
- Small: just `3.3 kB` when minified and gzipped! The JSON query engine without parse/stringify is only `1.7 kB`.
14+
- Feature rich (50+ powerful functions and operators)
1515
- Easy to interoperate with thanks to the intermediate JSON format.
1616
- Expressive
1717
- Expandable
@@ -38,10 +38,14 @@ External pages:
3838

3939
## Installation
4040

41+
Install the JavaScript library via [npm](https://www.npmjs.com/):
42+
4143
```text
4244
npm install @jsonquerylang/jsonquery
4345
```
4446

47+
A Python implementation can be found here: https://github.com/jsonquerylang/jsonquery-python
48+
4549
## Usage
4650

4751
```js
@@ -61,22 +65,22 @@ const data = {
6165

6266
// Get the array containing the friends from the object, filter the friends that live in New York,
6367
// sort them by age, and pick just the name and age out of the objects.
64-
const names = jsonquery(data, `
68+
const output = jsonquery(data, `
6569
.friends
6670
| filter(.city == "New York")
6771
| sort(.age)
6872
| pick(.name, .age)
6973
`)
70-
// names = [
74+
// output = [
7175
// { "name": "Chris", "age": 23 },
7276
// { "name": "Sarah", "age": 31 },
7377
// { "name": "Joe", "age": 32 }
7478
// ]
7579

76-
// The same query can be written in JSON format.
77-
// The functions `parse` and `stringify` can be used
80+
// The same query can be written in JSON format instead of the text format.
81+
// Note that the functions `parse` and `stringify` can be used
7882
// to convert from text format to JSON format and vice versa.
79-
jsonquery(shoppingCart, [
83+
jsonquery(data, [
8084
"pipe",
8185
["get", "friends"],
8286
["filter", ["eq", ["get", "city"], "New York"]],

docs/index.html

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,29 @@ <h1>JSON Query</h1>
115115
<a href="https://github.com/jsonquerylang/jsonquery/blob/main/reference/functions.md#sort"
116116
target="_blank"><code>sort(property, direction)</code></a>
117117
</li>
118+
<li>
119+
<a href="https://github.com/jsonquerylang/jsonquery/blob/main/reference/functions.md#reverse"
120+
target="_blank"><code>reverse()</code></a>
121+
</li>
118122
<li>
119123
<a href="https://github.com/jsonquerylang/jsonquery/blob/main/reference/functions.md#pick"
120124
target="_blank"><code>pick(property1, property2, ...)</code></a>
121125
</li>
122126
<li>
123127
<a href="https://github.com/jsonquerylang/jsonquery/blob/main/reference/functions.md#map"
124-
target="_blank"><code>map(query)</code></a>
128+
target="_blank"><code>map(callback)</code></a>
129+
</li>
130+
<li>
131+
<a href="https://github.com/jsonquerylang/jsonquery/blob/main/reference/functions.md#mapObject"
132+
target="_blank"><code>mapObject(callback)</code></a>
133+
</li>
134+
<li>
135+
<a href="https://github.com/jsonquerylang/jsonquery/blob/main/reference/functions.md#mapKeys"
136+
target="_blank"><code>mapKeys(callback)</code></a>
137+
</li>
138+
<li>
139+
<a href="https://github.com/jsonquerylang/jsonquery/blob/main/reference/functions.md#mapValues"
140+
target="_blank"><code>mapValues(callback)</code></a>
125141
</li>
126142
<li>
127143
<a href="https://github.com/jsonquerylang/jsonquery/blob/main/reference/functions.md#pipe"
@@ -155,6 +171,14 @@ <h1>JSON Query</h1>
155171
<a href="https://github.com/jsonquerylang/jsonquery/blob/main/reference/functions.md#flatten"
156172
target="_blank"><code>flatten()</code></a>
157173
</li>
174+
<li>
175+
<a href="https://github.com/jsonquerylang/jsonquery/blob/main/reference/functions.md#join"
176+
target="_blank"><code>join(separator)</code></a>
177+
</li>
178+
<li>
179+
<a href="https://github.com/jsonquerylang/jsonquery/blob/main/reference/functions.md#split"
180+
target="_blank"><code>split(text, separator)</code></a>
181+
</li>
158182
<li>
159183
<a href="https://github.com/jsonquerylang/jsonquery/blob/main/reference/functions.md#uniq"
160184
target="_blank"><code>uniq()</code></a>
@@ -218,6 +242,14 @@ <h1>JSON Query</h1>
218242
<a href="https://github.com/jsonquerylang/jsonquery/blob/main/reference/functions.md#abs"
219243
target="_blank"><code>abs(value)</code></a>
220244
</li>
245+
<li>
246+
<a href="https://github.com/jsonquerylang/jsonquery/blob/main/reference/functions.md#number"
247+
target="_blank"><code>number(text)</code></a>
248+
</li>
249+
<li>
250+
<a href="https://github.com/jsonquerylang/jsonquery/blob/main/reference/functions.md#string"
251+
target="_blank"><code>string(number)</code></a>
252+
</li>
221253
</ul>
222254
</div>
223255
</details>

0 commit comments

Comments
 (0)