Parsing json value into text line by line

Hey I want to output this value https://sonar.omnisint.io/subdomains/ejemplo.com in the following format.

Can anyone help please?

_dmarc.ejemplo.com
_mta-sts.ejemplo.com
deathstar.ejemplo.com
docs.ejemplo.com
ejemplo.com
ejemplo.ejemplo.com
es.ejemplo.com
ftp.ejemplo.com
host.ejemplo.com
listas.ejemplo.com
m.ejemplo.com
mail.ejemplo.com
miservidor.ejemplo.com
misitio.ejemplo.com
ns.ejemplo.com
otro.ejemplo.com
server1.ejemplo.com
sitio.ejemplo.com
target.ejemplo.com
test2.ejemplo.com
ubuzimbra.ejemplo.com
us.ejemplo.com
ws01.ejemplo.com
www.ejemplo.com
wwww.ejemplo.com
zimbra8.ejemplo.com

Hello,

is not clear to me if you’re asking hot to print the list of strings returned by the API call or how to get the list calling the URL.

var values []string

if err := json.Unmarshal([]byte(response), &values); err != nil {
	panic("something bad happened")
}

for _, item := range values {
	fmt.Println(item)
}

assuming response contains the JSON string returned by the API call, this code prints the strings one per line

1 Like

Hey that help me a lot. I got it now.

Thank you for your help!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.