Support ."foo" syntax for accessing fields. See #141.
This commit is contained in:
1 parent
c8ab67be27
commit
81e2336ace
3 files changed
+17
-1
No files matched your search
@@ -160,10 +160,13 @@ sections:
|
||||
- title: "`.foo`"
|
||||
body: |
|
||||
|
||||
The simplest *useful* filter is .foo. When given a
|
||||
The simplest *useful* filter is `.foo`. When given a
|
||||
JSON object (aka dictionary or hash) as input, it produces
|
||||
the value at the key "foo", or null if there's none present.
|
||||
|
||||
If the key contains special characters, you need to surround
|
||||
it with double quotes like this: `."foo$"`.
|
||||
|
||||
examples:
|
||||
- program: '.foo'
|
||||
input: '{"foo": 42, "bar": "less interesting data"}'
|
||||
@@ -171,6 +174,9 @@ sections:
|
||||
- program: '.foo'
|
||||
input: '{"notfoo": true, "alsonotfoo": false}'
|
||||
output: ['null']
|
||||
- program: '."foo"'
|
||||
input: '{"foo": 42}'
|
||||
output: [42]
|
||||
|
||||
- title: "`.[foo]`, `.[2]`, `.[10:15]`"
|
||||
body: |
|
||||
|
||||
Reference in new issue
Block a user