--- page_title: jsondecode function reference description: |- The `jsondecode` function decodes a JSON string into its corresponding Packer value. --- ⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️ > [!IMPORTANT] > **Documentation Update:** Product documentation previously located in `/website` has moved to the [`hashicorp/web-unified-docs`](https://github.com/hashicorp/web-unified-docs) repository, where all product documentation is now centralized. Please make contributions directly to `web-unified-docs`, since changes to `/website` in this repository will not appear on developer.hashicorp.com. ⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️ # `jsondecode` Function `jsondecode` interprets a given string as JSON, returning a representation of the result of decoding that string. The JSON encoding is defined in [RFC 7159](https://tools.ietf.org/html/rfc7159). This function maps JSON values to [Packer language values](/packer/docs/templates/hcl_templates/expressions#types-and-values) in the following way: | JSON type | Packer type | | --------- | ------------------------------------------------------------ | | String | `string` | | Number | `number` | | Boolean | `bool` | | Object | `object(...)` with attribute types determined per this table | | Array | `tuple(...)` with element types determined per this table | | Null | The Packer language `null` value | The Packer language automatic type conversion rules mean that you don't usually need to worry about exactly what type is produced for a given value, and can just use the result in an intuitive way. ## Examples ```shell-session > jsondecode("{\"hello\": \"world\"}") { "hello" = "world" } > jsondecode("true") true ``` ## Related Functions - [`jsonencode`](/packer/docs/templates/hcl_templates/functions/encoding/jsonencode) performs the opposite operation, _encoding_ a value as JSON.