Commit Graph

252 Commits

Author SHA1 Message Date
tidwall 807836a222 Minor update 2021-09-01 07:25:06 -07:00
tidwall 44b8c19d87 Minor update to test 2021-09-01 07:24:15 -07:00
tidwall 160fb9d6a1 Updated comments 2021-09-01 07:24:00 -07:00
Josh Baker 52919fa7b0
Merge pull request #222 from sspaink/arrayindex
Add support to return multiple indexes when multiple matches are found
2021-09-01 07:17:47 -07:00
Sebastian Spaink 7405f21134 Rename to indexes
Set to nil when modifiers used
2021-07-09 18:15:56 -05:00
Josh a5e52e5b06
Merge pull request #225 from MicahParks/master
Quick typo
2021-07-07 07:06:43 -07:00
Micah Parks d3daff0185 Quick typo. 2021-07-06 21:52:23 -04:00
Bas 7460ecfe69 Fix test 2021-07-01 06:00:44 -05:00
Bas 9b49f6eef5 Undo unnecessary change 2021-07-01 05:58:26 -05:00
Bas 73b86a9fc9 Support queries 2021-07-01 05:58:24 -05:00
Sebastian Spaink 34ea511746 Support getting index for hastags 2021-07-01 05:57:36 -05:00
tidwall 2feb4037b4 Fix escaped strings missing double quote
fixes #223
2021-06-30 13:18:28 -07:00
tidwall ca5c4b1e26 Update SYNTAX.md 2021-05-14 09:08:32 -07:00
tidwall 7a0721334f Fix syntax 2021-05-14 09:02:12 -07:00
tidwall 3c11634522 Update SYNTAX.md 2021-05-14 08:58:36 -07:00
tidwall d7dbdd1d92 Add tilde boolean operator
This commit adds the new tilde '~' operator, which when used will
convert a value to a boolean before comparison.

For example, using the following JSON:

    {
      "vals": [
        { "a": 1, "b": true },
        { "a": 2, "b": true },
        { "a": 3, "b": false },
        { "a": 4, "b": "0" },
        { "a": 5, "b": 0 },
        { "a": 6, "b": "1" },
        { "a": 7, "b": 1 }
        { "a": 8, "b": "true" },
        { "a": 9, "b": false }
        { "a": 10, "b": null }
        { "a": 11 }
      ]
    }

You can now query for all true(ish) values:

    vals.#(b==~true)#

Which returns:

    [1,2,6,7,8]

Or all false(ish) values:

    vals.#(b==~false)#

Which returns:

    [3,4,5,9,10,11]

The last value which was non-existent is treated as "false"
2021-05-14 08:53:58 -07:00
Josh Baker 51e0e24a13
Delete file 2021-05-12 12:38:01 -07:00
tidwall d9710733f0 Allow escaped string characters in query values
Fixes #215
2021-04-19 09:43:16 -07:00
tidwall d6d786db3c Remove dead code 2021-04-19 09:18:03 -07:00
tidwall 8ac92b3ad3 Remove unreachable code 2021-04-19 09:13:24 -07:00
Josh Baker f3ac38cbb5
Update README.md 2021-04-12 12:41:48 -07:00
Josh Baker 7dde6ac0f6
Merge pull request #211 from realzhili/fix-readme
Update README.md
2021-04-02 07:47:40 -07:00
Zhili Zhang 0301407223 Update README.md 2021-04-01 19:03:29 -07:00
tidwall dee0375ffd Fix negative without int part for valid
fixes #210
2021-03-28 18:30:25 -07:00
Josh Baker 15a2428bae
Create FUNDING.yml 2021-03-28 08:59:52 -07:00
Josh Baker 9e749076bf
Update README.md 2021-03-27 13:24:45 -07:00
Josh Baker 68c884f545
Update SYNTAX.md 2021-03-27 12:06:30 -07:00
Josh Baker e78ccfebe4
Update SYNTAX.md 2021-03-27 12:05:13 -07:00
tidwall d6cb589fc4 Fix non-existent response from multires query on empty array
This commit fixes an issue where a multires query on an empty
array will result in a non-existent (empty string) result.

For example `Get("[]", "#(key=value)#").Raw` resulted in an
empty string. But, it should actually result in the empty
array `[]`.
2021-03-25 15:31:00 -07:00
tidwall c75c954102 Fix mod flatten including non-existent arrays 2021-03-25 08:28:15 -07:00
Josh b61527bf1a
Merge pull request #209 from zepatrik/bump-pretty
Bump pretty dependency
2021-03-22 13:05:50 -07:00
zepatrik 2d7fa902d3
Bump pretty
especially to include c41759c9c4
2021-03-22 20:09:24 +01:00
tidwall d18e16d152 Allow chaining multipaths using the dot 2021-03-22 04:19:47 -07:00
Josh 7419d01876
Update README.md 2021-03-05 08:23:41 -07:00
Josh Baker b977acbb8b
Merge pull request #203 from rkilingr/documentation/json-integers
Creates a constant for maximum and minimum JSON Integers and documents them
2021-02-15 12:27:48 -07:00
RaviKiran Kilingar 59f8f07cff
Documents the integer constants used in safeInt and provides links 2021-02-15 23:29:11 +05:30
tidwall 65353b6d52 Removed reflect package
This commit removes the reflect package to avoid using the
reflect.SliceHeader and reflect.StringHeader structures. Instead
new sliceHeader and stringHeader stuctures have been added with
the same layout expect that they intentionally expose the data
field as an unsafe.Pointer instead of a uintptr.
2021-01-30 12:50:49 -07:00
tidwall 97ec619cbe Restrict pretty indent and prefixes to whitespace 2020-12-25 06:42:20 -07:00
tidwall bf4efcb3c1 Fix slice out of bounds panic
fixes #196
2020-12-24 09:51:53 -07:00
tidwall 9f58baa7a6 Update the match package
This commit updates the match package to v1.0.3, which includes
a fix to an issue where a pattern with lots of repetitive stars
will increasingly slow down a Match operation.

Fixes #195
2020-12-23 05:00:23 -07:00
tidwall f0ee9ebde4 Fix bounds out of range panic
This commit fixes an issues where gjson panics when the input json
or path ends in incomplete quoted string.

fixes #192
2020-12-07 05:25:20 -07:00
tidwall 5100d6926a Better safe integer range for numbers
This commit optimizes the safe float to int conversion function
by using the full -9007199254740991 to 9007199254740991 range as
suggested at:

https://tc39.es/ecma262/#sec-number.min_safe_integer

closes #174
2020-11-04 16:26:43 -07:00
tidwall 2f043b7abd Adjusted test 2020-11-04 16:01:22 -07:00
tidwall 71341b2042 Use lowercase string booleans 2020-11-04 15:59:08 -07:00
tidwall eeddc5431f Merge branch 'deef0000dragon1-deef0000dragon1-ParseBool' 2020-11-04 15:54:24 -07:00
tidwall ed7c6c18ed Merge branch 'deef0000dragon1-ParseBool' of https://github.com/deef0000dragon1/gjson into deef0000dragon1-deef0000dragon1-ParseBool 2020-11-04 15:53:35 -07:00
Josh Baker 20b6add63a
Merge pull request #163 from Jalitha/patch-1
Fix typo in .Get comment
2020-11-04 15:12:32 -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 37d86694e2
Create go.yml 2020-11-03 11:38:19 -07:00
Josh Baker 23c5e2620b
Delete .travis.yml 2020-11-03 11:38:11 -07:00