github.com/muratcelep/terraform@v1.1.0-beta2-not-internal-4/website/docs/language/functions/jsondecode.html.md (about) 1 --- 2 layout: "language" 3 page_title: "jsondecode - Functions - Configuration Language" 4 sidebar_current: "docs-funcs-encoding-jsondecode" 5 description: |- 6 The jsondecode function decodes a JSON string into a representation of its 7 value. 8 --- 9 10 # `jsondecode` Function 11 12 `jsondecode` interprets a given string as JSON, returning a representation 13 of the result of decoding that string. 14 15 The JSON encoding is defined in [RFC 7159](https://tools.ietf.org/html/rfc7159). 16 17 This function maps JSON values to 18 [Terraform language values](/docs/language/expressions/types.html) 19 in the following way: 20 21 | JSON type | Terraform type | 22 | --------- | ------------------------------------------------------------ | 23 | String | `string` | 24 | Number | `number` | 25 | Boolean | `bool` | 26 | Object | `object(...)` with attribute types determined per this table | 27 | Array | `tuple(...)` with element types determined per this table | 28 | Null | The Terraform language `null` value | 29 30 The Terraform language automatic type conversion rules mean that you don't 31 usually need to worry about exactly what type is produced for a given value, 32 and can just use the result in an intuitive way. 33 34 ## Examples 35 36 ``` 37 > jsondecode("{\"hello\": \"world\"}") 38 { 39 "hello" = "world" 40 } 41 > jsondecode("true") 42 true 43 ``` 44 45 ## Related Functions 46 47 * [`jsonencode`](./jsonencode.html) performs the opposite operation, _encoding_ 48 a value as JSON.