github.com/hugorut/terraform@v1.1.3/website/docs/language/functions/jsondecode.mdx (about)

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