jsondecode(str) parses str as JSON and returns the decoded value. JSON objects become typed objects with named attributes, JSON arrays become tuples, strings, numbers, and booleans map to their equivalent types, and null becomes a null value.
Signature
Example
Read a JSON configuration file and use its values in task commands:deploy.json:
kubectl set image deployment/api app=registry.example.com/api:1.4.2.
Notes
- If
stris not valid JSON,jsondecodereports an error at evaluation time. - To produce JSON from a value, use
jsonencode.