Skip to content

Commit

Permalink
Support for JSON Lines
Browse files Browse the repository at this point in the history
  • Loading branch information
tidwall committed Feb 9, 2018
1 parent ab4318a commit 4650baa
Show file tree
Hide file tree
Showing 5 changed files with 425 additions and 490 deletions.
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Examples

### Getting a value

JJ uses a special [path syntax](https://github.com/tidwall/gjson#path-syntax) for finding values.
JJ uses a [path syntax](https://github.com/tidwall/gjson#path-syntax) for finding values.

Get a string:
```sh
Expand Down Expand Up @@ -95,6 +95,26 @@ $ echo '{"friends":["Tom","Jane","Carol"]}' | jj friends.1
Jane
```

## JSON Lines

There's support for [JSON Lines](http://jsonlines.org/) using the `..` path prefix.
Which when specified, treats the multi-lined document as an array.

For example:

```
{"name": "Gilbert", "age": 61}
{"name": "Alexa", "age": 34}
{"name": "May", "age": 57}
```

```
..# >> 4
..1 >> {"name": "Alexa", "age": 34}
..#.name >> ["Gilbert","Alexa","May"]
..#[name="May"].age >> 57
```

### Setting a value

The [path syntax](https://github.com/tidwall/sjson#path-syntax) for setting values has a couple of tiny differences than for getting values.
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -e

VERSION="1.1.2"
VERSION="1.2.0"
PROTECTED_MODE="no"

export GO15VENDOREXPERIMENT=1
Expand Down
125 changes: 49 additions & 76 deletions vendor/github.com/tidwall/gjson/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4650baa

Please sign in to comment.