diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2019-04-06 23:42:39 -0400 |
|---|---|---|
| committer | Dave Henderson <dhenderson@gmail.com> | 2019-04-09 20:13:50 -0400 |
| commit | 51ea3780766b1d3dacf0b2c87703d3b95d95aa38 (patch) | |
| tree | 7009dbdf062b8f3fc23cf6a119224c1e3d801b5d /docs-src | |
| parent | 0863119d86f54d2e62f5dcd055086e35b5dc5865 (diff) | |
Adding coll.JSONPath function
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'docs-src')
| -rw-r--r-- | docs-src/content/functions/coll.yml | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/docs-src/content/functions/coll.yml b/docs-src/content/functions/coll.yml index b00c14b0..58fb9b3f 100644 --- a/docs-src/content/functions/coll.yml +++ b/docs-src/content/functions/coll.yml @@ -83,6 +83,28 @@ funcs: $ gomplate -i '{{ $o := data.JSON (getenv "DATA") -}} {{ if (has $o "foo") }}{{ $o.foo }}{{ else }}THERE IS NO FOO{{ end }}' THERE IS NO FOO + - name: conv.JSONPath + alias: jsonpath + description: | + Extracts portions of an input object or list using a [JSONPath][] expression. + + Any object or list may be used as input. The output depends somewhat on the expression; if multiple items are matched, an array is returned. + + JSONPath expressions can be validated at https://jsonpath.com + + [JSONPath]: https://goessner.net/articles/JsonPath + pipeline: true + arguments: + - name: expression + required: true + description: The JSONPath expression + - name: in + required: true + description: The object or list to query + examples: + - | + $ gomplate -i '{{ .books | jsonpath `$..works[?( @.edition_count > 400 )].title` }}' -c books=https://openlibrary.org/subjects/fantasy.json + [Alice's Adventures in Wonderland Gulliver's Travels] - name: coll.Keys alias: keys description: | |
