Commit Graph

21 Commits

Author SHA1 Message Date
tidwall b279807a1b Fixed #61
See 475b4036c3
2022-08-04 18:15:59 -07:00
tidwall 0bc94ab89f Allow for updating values using queries and wildcards
This commit allows for updating values for more "complex" paths like:

	friends.#(last="Murphy")#.last

This is allowed because GJSON now tracks the origin positions of all
results (https://github.com/tidwall/gjson/pull/222).

This new ability is limited to updating values only. Setting new
values that previously did not exist, or deleting values will
return an error.
2021-09-04 07:45:12 -07:00
tidwall a2a89c2f1e Update gjson and fix golint messages 2021-09-01 20:12:27 -07:00
tidwall 11cb24d842 Fix trailing curly bracket
close #36
2020-04-01 05:03:04 -07:00
tidwall 4f7b016772 Append new members to objects
The Set operation now appends key values to objects when that key
previously did not exist. Before the key value was prepended.

Close #35
2020-03-31 03:52:06 -07:00
Joshua Welsh 82a6448692
Ensure backslashes are always escaped 2018-11-07 10:46:21 +00:00
Joshua Welsh dc363de894
Added backslash escaping test case 2018-11-07 10:28:15 +00:00
tidwall ce26db08c7 Merge branch 'fix-backslashes' of https://github.com/hypoactiv/sjson into hypoactiv-fix-backslashes 2018-09-17 10:17:31 -07:00
tidwall 64c369cb32 Fix conflicts 2018-09-17 10:11:44 -07:00
tidwall 0ffb6cd769 Fix operations with escaped dots in keys
This commit fixes a bug where keys with dots could not be
correctly updated.

fixes #10 and #19
2018-09-17 09:56:37 -07:00
tidwall 6f2b60cb22 Fix Delete misfire
This commit fixes an issue where there Delete operation would sometimes remove a previous element.

closes #21
2018-09-17 08:50:59 -07:00
tidwall d43f0343ba Move benchmarks to new repo 2018-09-17 08:12:19 -07:00
tidwall bd0e703dc8 fix tests 2018-08-31 16:55:59 -06:00
Jonathan Schroeder 051af16d40 Fix incorrect handling of backslash at end of strings 2018-07-03 21:32:43 -04:00
Chen Peng c52ef8602e #10 Unclear how to escape a dot . in JSON keys 2018-03-24 18:26:58 +08:00
Josh Baker 6a22caf2fd append non-existent array element 2016-12-12 09:54:44 -07:00
Josh Baker d87100011f Added benchmarks comparing other libraries. See #3 2016-11-21 14:07:39 -07:00
Josh Baker a47c1e938e Added ReplaceInPlace Option
Allows for replacing the input byte slice instead of allocating new
memory.
2016-10-25 12:42:02 -07:00
Josh Baker e6094ca119 Optimistic Set
Added the Option type with the Optimistic field. This field can be
used when the caller expects that a value at the specified path
already exists. The Set operation will used `gjson.Get` on the
full path to the value and replace it with the new value.

If Optimistic is specified but the value is not found, then the
normal Set operation is used.

Using Optimistic can speed up a Set operation by as much as 4x.
2016-10-25 11:10:26 -07:00
Josh Baker 39c9d6d25d added delete function 2016-10-20 12:06:19 -07:00
Josh Baker 4e588076ed first commit 2016-10-18 19:06:50 -07:00