I get a http response of the Hetzner API which provides information about all volumes. I want to build a menu with dialog, where you can choose out of all existing volumes. This way I get the API's answer:
ALL_VOLUMES_HTTP=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" -H "Authorization: Bearer $1" https://api.hetzner.cloud/v1/volumes)
which is filtered by jq in this way
ALL_VOLUME_NAMES=$(jq '.volumes[].name' <<< "$ALL_VOLUMES_HTTP")
the output of ALL_VOLUME_NAMES
is formatted like this
"volumeName1"
"volumeName2"
but in the menu dialog it is displayed like in this image
I already tried to put brackets about the jq (jq '[.volumes[].name'
) but it is displayed completely wrong too like in this example
For generating the interface I am using the following code:
SELECTED_VOLUME=$(dialog --title "Volume mount" --menu "Select:" 0 0 0 $ALL_VOLUME_NAMES 3>&1 1>&2 2>&3)
So how can I generate a correct menu interface in dialog with the given data?