Commit Graph

20 Commits

Author SHA1 Message Date
tidwall 38071ea7f2 Add tostr and fromstr modifiers
For wrapping and unwrapping json strings
2022-01-13 09:15:39 -07:00
Josh Baker ba95ef80b5
Update SYNTAX.md 2021-12-10 09:23:12 -07:00
Josh Baker 65bbebbdf7
Fixed typo 2021-12-08 09:42:11 -07:00
tidwall 9eae1fa87b Added JSON Literals 2021-11-30 10:18:36 -07:00
tidwall 35fa0d71c8 Added @keys and @values modifiers
The "@keys" and "@values" modifiers converts an object into an
array of its keys or values respectively.

Take this json for example:

{"first":"Tom","last":"Smith"}

@keys   -> ["first","last"]
@values -> ["Tom","Smith"]

This feature was requested in #161.
2021-10-20 16:31:29 -07:00
Micah Parks d3daff0185 Quick typo. 2021-07-06 21:52:23 -04: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
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
Prithvipal Singh 1879ad91cd Addressed review suggestion 2020-02-22 23:25:31 +05:30
Prithvipal Singh 0439aef712 Fixed syntax document for escape character 2020-02-22 22:50:13 +05:30
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
aeneasr 8e8823353c
Add @this modifier
This modifier returns the current element as-is and can be used
to retrieve the JSON document itself. It is equivalent to the `#/` JSON Pointer.

Closes #149
2020-01-20 15:01:54 +01:00
tidwall 94e070960b Add link to multipaths 2019-11-01 05:15:58 -07:00
tidwall dea71f728d Mention nested queries 2019-07-12 06:46:38 -07:00
Josh Baker 90ca17622f
Update SYNTAX.md 2019-07-10 15:00:07 -07:00
tidwall 4d138e058b Add multipath syntax 2019-06-30 12:59:56 -07:00
tidwall f8322e865d Rename file 2019-06-28 17:18:24 -07:00