summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorDave Henderson <dhenderson@gmail.com>2016-03-25 23:01:49 -0400
committerDave Henderson <dhenderson@gmail.com>2016-03-25 23:06:31 -0400
commit158995a0b79a957ac5b7dfe1777e3dc9c4458468 (patch)
tree11b9a2b43688466a2649ddeda5eea9c5cf361e7d /README.md
parent2a00d3e46287bc9fc810924f488dc5a7f03a27b0 (diff)
Adding json filter function
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'README.md')
-rw-r--r--README.md17
1 files changed, 17 insertions, 0 deletions
diff --git a/README.md b/README.md
index 6bb1a508..1b73a8b6 100644
--- a/README.md
+++ b/README.md
@@ -73,6 +73,23 @@ $ FOO=true gomplate < input.tmpl
foo
```
+#### `json`
+
+Converts a JSON string into an object. Only works for JSON Objects. This can be used to access properties of JSON objects.
+
+##### Example
+
+_`input.tmpl`:_
+```
+Hello {{ (getenv "FOO" | json).hello }}
+```
+
+```console
+$ export FOO='{"hello":"world"}'
+$ gomplate < input.tmpl
+Hello world
+```
+
### Some more complex examples
##### Variable assignment and `if`/`else`