For AI agents: the complete documentation index is available at /hclapi/llms.txt, the full documentation bundle is available at /hclapi/llms-full.txt, and this page is available as Markdown at /hclapi/docs/manifest/functions/encoding/json_decode.md.

json_decode

Parses a JSON string into corresponding HCL primitives, lists, or maps.

Signature

json_decode(str: string) -> any

Parameters

ParameterTypeRequiredDescription
strstringyesThe JSON string to parse

Return value

Returns the documented result for the function signature.

Example

redis "cache_lookup" {
  connection = connection.redis.cache
  command    = "GET"
  key        = "product:${ctx.request.path.id}"
}

respond {
  condition = steps.cache_lookup.value != null
  status    = 200
  body      = json_decode(steps.cache_lookup.value)
}