hi, I am struggling to understand how to use this map[string]interface{}.
snippet: package main import "fmt" import "github.com/mattwilmott/go-foreman" func main() { client := foreman.Client("foreman.l.example.org", "admin", "whatever", false, "") fmt.Println(client) resp, err := client.Get("hosts") if err != nil { fmt.Println(err) } fmt.Println(resp) } Foreman GET: map[page:1 per_page:20 results:[map[architecture_id:1 architecture_name:x86_64 build:false capabilities:[build] certname:foreman.l.example.org comment:<nil> compute_profile_id:<nil> compute_profile_name:<nil> compute_resource_id:<nil> compute_resource_name:<nil> configuration_status:0 configuration_status_label:Out of sync created_at:2021-05-30 20:54:20 UTC disk:<nil> domain_id:1 domain_name:l.example.org enabled:true environment_id:1 environment_name:production global_status:0 global_status_label:Warning hostgroup_id:<nil> hostgroup_name:<nil> hostgroup_title:<nil> id:1 image_file: image_id:<nil> image_name:<nil> installed_at:<nil> ip:<nil> ip6:2001:470:7b79:100::44e last_compile:<nil> last_report:2021-05-30 20:54:15 UTC location_id:2 location_name:Default Location mac:ba:a6:69:6e:31:6c managed:false medium_id:<nil> medium_name:<nil> model_id:1 model_name:Latitude E7250 name:foreman.l.example.org operatingsystem_id:1 operatingsystem_name:CentOS 7.9.2009 organization_id:1 organization_name:Default Organization owner_id:<nil> owner_name:<nil> owner_type:<nil> provision_method:build ptable_id:<nil> ptable_name:<nil> puppet_ca_proxy:map[id:1 name:foreman.l.example.org url:https://foreman.l.example.org:8443] puppet_ca_proxy_id:1 puppet_ca_proxy_name:foreman.l.example.org puppet_proxy:map[id:1 name:foreman.l.example.org url:https://foreman.l.example.org:8443] puppet_proxy_id:1 puppet_proxy_name:foreman.l.example.org puppet_status:0 pxe_loader:<nil> realm_id:<nil> realm_name:<nil> sp_ip:<nil> sp_mac:<nil> sp_name:<nil> sp_subnet_id:<nil> subnet6_id:<nil> subnet6_name:<nil> subnet_id:<nil> subnet_name:<nil> updated_at:2021-05-30 20:54:23 UTC uptime_seconds:11692 use_image:<nil> uuid:<nil>]] search:<nil> sort:map[by:<nil> order:<nil>] subtotal:1 total:1] map[page:1 per_page:20 results:[map[architecture_id:1 architecture_name:x86_64 build:false capabilities:[build] certname:foreman.l.example.org comment:<nil> compute_profile_id:<nil> compute_profile_name:<nil> compute_resource_id:<nil> compute_resource_name:<nil> configuration_status:0 configuration_status_label:Out of sync created_at:2021-05-30 20:54:20 UTC disk:<nil> domain_id:1 domain_name:l.example.org enabled:true environment_id:1 environment_name:production global_status:0 global_status_label:Warning hostgroup_id:<nil> hostgroup_name:<nil> hostgroup_title:<nil> id:1 image_file: image_id:<nil> image_name:<nil> installed_at:<nil> ip:<nil> ip6:2001:470:7b79:100::44e last_compile:<nil> last_report:2021-05-30 20:54:15 UTC location_id:2 location_name:Default Location mac:ba:a6:69:6e:31:6c managed:false medium_id:<nil> medium_name:<nil> model_id:1 model_name:Latitude E7250 name:foreman.l.example.org operatingsystem_id:1 operatingsystem_name:CentOS 7.9.2009 organization_id:1 organization_name:Default Organization owner_id:<nil> owner_name:<nil> owner_type:<nil> provision_method:build ptable_id:<nil> ptable_name:<nil> puppet_ca_proxy:map[id:1 name:foreman.l.example.org url:https://foreman.l.example.org:8443] puppet_ca_proxy_id:1 puppet_ca_proxy_name:foreman.l.example.org puppet_proxy:map[id:1 name:foreman.l.example.org url:https://foreman.l.example.org:8443] puppet_proxy_id:1 puppet_proxy_name:foreman.l.example.org puppet_status:0 pxe_loader:<nil> realm_id:<nil> realm_name:<nil> sp_ip:<nil> sp_mac:<nil> sp_name:<nil> sp_subnet_id:<nil> subnet6_id:<nil> subnet6_name:<nil> subnet_id:<nil> subnet_name:<nil> updated_at:2021-05-30 20:54:23 UTC uptime_seconds:11692 use_image:<nil> uuid:<nil>]] search:<nil> sort:map[by:<nil> order:<nil>] subtotal:1 total:1] I understand this map[string]interface{} allows me to not have to define every json struct beforehand, but how can I parse it? Thanks in advance. Regards, Natxo -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/856474a1-db18-4433-8233-b6c3fad29868n%40googlegroups.com.