Open zhaojinxin409 opened 1 week ago
Calling GetHost always error: Error decoding JSON response body: json: cannot unmarshal string into Go struct field Host.inventory_mode of type int
Error decoding JSON response body: json: cannot unmarshal string into Go struct field Host.inventory_mode of type int
hosts, err := session.GetHosts(zabbix.HostGetParams{ GetParameters: zabbix.GetParameters{ ResultLimit: 10, }, }) fmt.Println(hosts, err)
[] Error decoding JSON response body: json: cannot unmarshal string into Go struct field Host.inventory_mode of type int
I found that even though the Host Object's inventory_mode is int, but the response of zabbix convert it into string of integer, like :
{ "jsonrpc": "2.0", "result": [ { "inventory_mode": "-1" } }
May be the inventory field should be string?
Calling GetHost always error:
Error decoding JSON response body: json: cannot unmarshal string into Go struct field Host.inventory_mode of type int
MyCode
Output:
Reason
I found that even though the Host Object's inventory_mode is int, but the response of zabbix convert it into string of integer, like :