Commit Graph

122 Commits

Author SHA1 Message Date
Josh Baker 62892351c5 added ForEach function 2016-11-30 10:50:59 -07:00
Josh Baker 86b1b630e4 Query array for multiple matches
It's now possible to query an array for multiple matches by adding the
'#' character immediately following the query.

For example, using the following JSON:

  {
    "friends": [
      {"first": "Dale", "last": "Murphy"},
      {"first": "Roger", "last": "Craig"},
      {"first": "Jane", "last": "Murphy"}
    ]
  }

To return the first match:

  `friends.#[last="Murphy"].first` >> "Dale"

To return all matches:

  `friends.#[last="Murphy"]#.first` >> ["Dale","Jane"]

Thanks to @chuttam for requesting this feature, closes #15.
2016-11-30 07:59:24 -07:00
Josh Baker 1303e83611 fix lead comma error 2016-11-29 18:08:02 -07:00
Josh Baker 1a15b54bbb add bookmark link for GetMany 2016-11-28 19:04:18 -07:00
Josh Baker ae5d307631 Added GetMany. Query many paths at once.
The `GetMany(json, paths...)` function can be used to get multiple
values at one time from the same json string.
This is preferrable to calling `Get(json, path)` over and over.
It's also optimized to scan over a JSON payload once.

This addresses a feature request by @FZambia, and closes #13.
2016-11-28 15:10:11 -07:00
Josh Baker 72b0cad1c1 example getting raw bytes, closes #12 2016-11-04 19:41:23 -07:00
Josh Baker ac4cd1ab55 empty arrays for non-existent values #11 2016-11-02 13:45:25 -07:00
Josh Baker 1584ec68ff Merge branch 'wI2L-master' 2016-11-02 12:45:57 -07:00
William Poussier 495633298f Modify behavior of Array() on non-array result.
Closes #10.
2016-11-02 20:20:24 +01:00
Josh Baker b95abbe94a removed obsolete field 2016-11-02 11:01:06 -07:00
Josh Baker a02d704254 added result.Uint() function resolves #9 2016-11-02 08:24:13 -07:00
Josh Baker 78babc5712 typo 2016-10-30 14:35:08 -07:00
Josh Baker bc89b871de typos 2016-10-28 10:56:10 -07:00
Josh Baker 95c6f92c50 mention GetBytes function 2016-10-28 09:07:48 -07:00
Josh Baker 5fdbb97fe1 mention jsoned 2016-10-25 22:03:43 -07:00
Josh Baker 27c108f475 fuzzing test on parse 2016-10-18 17:13:15 -07:00
Josh Baker 800ce5e927 added Index field 2016-10-17 17:39:27 -07:00
Josh Baker 2dec1c4e7b safe slices 2016-09-09 15:49:48 -07:00
Josh Baker 7c631e9868 fix out of range error 2016-09-08 09:02:40 -07:00
Josh Baker b39aa6075f bytes substring optimization 2016-09-08 08:34:01 -07:00
Josh Baker 124a25db9e added direct bytes interface 2016-09-08 08:08:53 -07:00
Josh Baker b7e578ec72 added extra test 2016-08-31 13:38:53 -07:00
Josh Baker 3e35b37021 fix subquery examples 2016-08-31 13:24:47 -07:00
Josh Baker f40fe4ac37 subquery syntax 2016-08-31 13:23:20 -07:00
Josh Baker 4d7d1a76a8 import match package 2016-08-30 07:21:20 -07:00
Josh Baker 550c66c276 added reset timer to all benchmarks 2016-08-27 06:20:43 -07:00
Josh Baker aed5ee957a updated logo 2016-08-25 20:35:55 -07:00
Josh Baker 3913125ac5 faster map unmarshalling 2016-08-25 20:17:32 -07:00
Josh Baker a6e9688393 lessen frequency of assignments in path routine 2016-08-25 10:05:03 -07:00
Josh Baker 81391efb66 minor optz 2016-08-25 09:40:50 -07:00
Josh Baker 19f9404e51 Updated logic for better ssa compilation in Go 1.7 2016-08-25 07:22:48 -07:00
Josh Baker d37f454044 wildcard match merge 2016-08-24 16:54:10 -07:00
Josh Baker 050904424f added unmarshal map test 2016-08-24 15:59:54 -07:00
Josh Baker f4c008206b added wildcard test 2016-08-24 15:50:18 -07:00
Josh Baker ffbbc90c13 remove commented code 2016-08-24 13:35:10 -07:00
Josh Baker 4fceff029c unicode patterns 2016-08-24 13:26:44 -07:00
Josh Baker a3ee82ebf9 Merge branch 'wildcard-match' of https://github.com/minio/gjson into minio-wildcard-match 2016-08-24 12:22:52 -07:00
Josh Baker 67e38154bd sped up map[string]interface{} unmarshalling 2016-08-24 12:12:07 -07:00
Harshavardhana 0608a3853a wildcard: Fix wildcard match behavior to support wide range.
This helps in supporting all types of patterns in wildcard match.
2016-08-24 11:58:10 -07:00
Josh Baker 0669befdc3 fixed typo in example 2016-08-24 08:06:20 -07:00
Josh Baker c6faea1947 addtional test 2016-08-22 08:26:44 -07:00
Josh Baker 16ecfe5970 addtional test 2016-08-22 08:25:33 -07:00
Josh Baker 696d68fd62 minor optimizations 2016-08-22 07:39:41 -07:00
Josh Baker b661f333a3 Update README.md 2016-08-22 06:13:09 -07:00
Josh Baker ad7311075f Update README.md 2016-08-22 06:11:47 -07:00
Josh Baker cd422a3e10 Removed Multi. Added Parse and result.Get funcs
The Multi field was too bulky. fixes #4
Added a Parse(json) function that will do a simple parse of json.
Added a result.Get(path) function that returns a child result.
Added Bool(), Int(), and Float() to result type. fixes #5
2016-08-22 06:05:51 -07:00
Josh Baker 44a8706c89 Merge branch 'master' of https://github.com/tidwall/gjson 2016-08-22 05:22:42 -07:00
Josh Baker e42a0961e6 added go tag to codeblock 2016-08-21 10:56:31 -07:00
Josh Baker 29fecf859f minor performance optz 2016-08-21 10:10:55 -07:00
Josh Baker 360ac81635 additional example 2016-08-21 09:56:42 -07:00