Param inside getjson url

Hello, How can i be able to put something from a param into a json url ?

For example:

$query := {{ .Params.query}}

{{ $json := getJSON “$query

seems like i can’t put query inside the json “url” :frowning:

Hey, you could do something like this

{{ $url := printf "" .Params.query }}
{{ $json := getJSON $url }}

Hello, thank you for reply, it get the param but gives an error

execute of template failed: template: _default/single.html:4:12: executing "main" at <getJSON $url>: error calling getJSON: Failed to create request for getJSON resource!s(int=417914): parse!s(int=417914): invalid URL escape "%!s"

Ah. So since your param is an int, change


to this