This question already has an answer here:
I am trying to
curl some URL which returns a json file, then I want to parse hosts from it and create a comma separated string.
I have the first part working
curl -s -u "admin:admin" -H "X-Requested-By: ambari" "https://hbasecluster.net/api/v1/clusters/mycluster/services/ZOOKEEPER/components/ZOOKEEPER_SERVER" | jq -r '.host_components.HostRoles.host_name'
zk0-mycluster.net zk1-mycluster.net zk2-mycluster.net
Now I want to join these into one string like