I get empty return for this
suntong opened this issue · comments
suntong commented
Can anyone help me to see what's wrong with the following line please?
it prints:
map[string]interface {}{}
while the previous test prints the following, which is what I want:
map[string]interface {}{"Servers":[]main.Server{main.Server{Name:"Arslan", ID:123456, Enabled:true}, main.Server{Name:"Arslan", ID:123456, Enabled:true}}}
How to fix it to make it working? Thx!
Fatih Arslan commented
Hi @suntong The servers
field need to be uppercase, so Servers
. Otherwise the reflect package will not read it. Here is the same example: https://play.golang.org/p/rP5q47J3Ke