Commit Graph

87 Commits

Author SHA1 Message Date
tidwall 160fb9d6a1 Updated comments 2021-09-01 07:24:00 -07:00
Sebastian Spaink 7405f21134 Rename to indexes
Set to nil when modifiers used
2021-07-09 18:15:56 -05:00
Bas 73b86a9fc9 Support queries 2021-07-01 05:58:24 -05:00
Josh Baker f3ac38cbb5
Update README.md 2021-04-12 12:41:48 -07:00
Zhili Zhang 0301407223 Update README.md 2021-04-01 19:03:29 -07:00
Josh Baker 9e749076bf
Update README.md 2021-03-27 13:24:45 -07:00
Josh 7419d01876
Update README.md 2021-03-05 08:23:41 -07:00
Josh Baker 140bf1266f
Merge pull request #179 from ader1990/master
Fixed small readme typos
2020-11-04 15:11:47 -07:00
Josh Baker 393cb5c3a9
Update README.md 2020-11-03 11:37:58 -07:00
Adrian Vladu 2679aa886d
Fixed small readme typos 2020-07-27 18:31:55 +03:00
tidwall 0360deb6d8 Added new modifiers
`@flatten` Flattens an array with child arrays.
  [1,[2],[3,4],[5,[6,7]]] -> [1,2,3,4,5,[6,7]]
The {"deep":true} arg can be provide for deep flattening.
  [1,[2],[3,4],[5,[6,7]]] -> [1,2,3,4,5,6,7]
The original json is returned when the json is not an array.

`@join` Joins multiple objects into a single object.
  [{"first":"Tom"},{"last":"Smith"}] -> {"first","Tom","last":"Smith"}
The arg can be "true" to specify that duplicate keys should be preserved.
  [{"first":"Tom","age":37},{"age":41}] -> {"first","Tom","age":37,"age":41}
Without preserved keys:
  [{"first":"Tom","age":37},{"age":41}] -> {"first","Tom","age":41}
The original json is returned when the json is not an object.

`@valid` Ensures that the json is valid before moving on. An
empty string is returned when the json is not valid, otherwise
it returns the original json.
2020-02-10 11:13:30 -07:00
tidwall dea71f728d Mention nested queries 2019-07-12 06:46:38 -07:00
tidwall 4d138e058b Add multipath syntax 2019-06-30 12:59:56 -07:00
Josh Baker f7c1980254
Update README.md 2019-06-28 17:17:38 -07:00
Josh Baker ae482cd23d
Update README.md 2019-06-28 17:16:29 -07:00
Josh Baker 181e11634d
Code typo 2019-02-16 19:21:12 -07:00
tidwall 1ed2249f74 Added modifiers and path chaining
A modifier is a path component that performs custom processing on
the json.

Multiple paths can be "chained" together using the pipe character.
This is useful for getting results from a modified query.

See the README file for more information.
2019-02-16 18:29:39 -07:00
thirstycoda cced0fa719 Added not like operator support to query 2018-10-28 00:20:01 +01:00
Josh Baker df0b0cce42
section on json validation 2018-02-18 09:49:01 -07:00
Josh Baker 46c712f1ce
update playground badge 2018-02-10 11:31:49 -07:00
Josh Baker 54d114d487
minor updates 2018-02-10 09:30:30 -07:00
Josh Baker 6d43584b26
mention related projects 2018-02-10 09:10:40 -07:00
Josh Baker 4b8623b9d6
minor edits 2018-02-09 19:51:56 -07:00
Josh Baker 749b396bb9
Update README.md 2018-02-09 16:09:45 -07:00
Josh Baker 077965694f
changed badge color 2018-02-09 16:08:32 -07:00
Josh Baker b9953e2865
Update README.md 2018-02-09 16:04:47 -07:00
Josh Baker a2f35b522e Added support for JSON Lines
Added support for JSON Lines (http://jsonlines.org) using the `..` 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}
{"name": "Deloise", "age": 44}
```

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

Closes #60
2018-02-09 15:42:42 -07:00
Josh Baker bff3f07fe7
mention large integer support 2018-02-08 12:21:08 -07:00
Josh Baker 09641abb33 update tagline 2017-12-22 07:16:29 -07:00
Josh Baker e62d62a3e1 match GetMany and Get results, fixes #55 2017-12-22 06:58:04 -07:00
Josh Baker ac7b6ae6f2 deprecated unmarshalling 2017-10-18 05:19:20 -07:00
Josh Baker 4e8f0c7f28 added playground link 2017-08-14 18:16:21 -07:00
Josh Baker 6daf3373dc Moved benchmark code
Moved benchmark to a different repository to avoid the fetching of
unneeded imports. Please find these benchmarks at
https://github.com/tidwall/gjson-benchmarks
2017-08-14 08:21:16 -07:00
Kashav Madan 8eb5c54ee3 Minor README clean-up 2017-05-10 23:42:56 -04:00
Josh Baker 617caec145 Update README.md 2017-05-08 21:47:28 -07:00
Josh Baker 2e78916f4a option to disable validation 2017-05-08 17:47:46 -07:00
Josh Baker 2555fc0b61 Unmarshal Validation
The Unmarshal function now returns an error if the JSON is not valid.
2017-05-08 17:33:03 -07:00
Josh Baker 0bedaf01cb updated wording 2017-05-08 07:47:07 -07:00
Josh Baker 371acf8f0c updated wording 2017-05-08 07:40:56 -07:00
Josh Baker 19194a58d8 typos 2017-05-08 06:55:29 -07:00
Josh Baker 3f5adf1ba9 New gjson.Unmarshal function
It's a drop in replacement for json.Unmarshal and you can typically see
a 3 to 4 times boost in performance without the need for external tools
or generators.

This function works almost identically to json.Unmarshal except that
it expects the json to be well-formed prior to being called. Invalid
json will not panic, but it may return back unexpected results.
Therefore the return value of this function will always be nil.

Another difference is that gjson.Unmarshal will automatically attempt
to convert JSON values to any Go type. For example, the JSON string
"100" or the JSON number 100 can be equally assigned to Go string,
int, byte, uint64, etc. This rule applies to all types.
2017-05-07 18:26:54 -07:00
Josh Baker 039b641eab added result.Time() function 2017-04-14 17:58:25 -07:00
Josh Baker 6e0babc7e8 updated benchmarks, added features list 2017-04-14 11:13:32 -07:00
Josh Baker a8ccb8767a mention "values" 2017-04-12 14:16:56 -07:00
Josh Baker 7d884e04ac minor update 2017-04-12 14:14:42 -07:00
Josh Baker 766ad13f76 minor updates 2017-04-10 12:26:09 -07:00
Josh Baker 9c689b0be6 cleanup benchmarks 2017-04-10 11:41:37 -07:00
Josh Baker 8f291465f6 added Exists() to the list of handy functions 2017-04-02 10:13:06 -07:00
Josh Baker 09d1c5c5bc added gjson-safe comment 2017-02-05 09:10:42 -07:00
Josh Baker e3f249f4fd Missing package alias 2016-12-16 09:22:41 -07:00