> ## Documentation Index
> Fetch the complete documentation index at: https://errand.nuvrel.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# jsondecode

> Parse a JSON string into a value.

`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

```
jsondecode(str string) any
```

## Example

Read a JSON configuration file and use its values in task commands:

```hcl theme={null}
computed "config" {
  description = "Parsed deployment configuration"
  expression  = jsondecode(file("deploy.json"))
}

task "deploy" {
  description = "Deploy using settings from the config file"
  commands = [
    "kubectl set image deployment/${computed.config["app"]} app=${computed.config["image"]}:${computed.config["tag"]}",
  ]
}
```

Given `deploy.json`:

```json theme={null}
{
  "app": "api",
  "image": "registry.example.com/api",
  "tag": "1.4.2"
}
```

The command becomes `kubectl set image deployment/api app=registry.example.com/api:1.4.2`.

## Notes

* If `str` is not valid JSON, `jsondecode` reports an error at evaluation time.
* To produce JSON from a value, use [`jsonencode`](/functions/encoding/jsonencode).
