This package: https://github.com/fatih/structs
Or, more generally, reflection or code generation. For your specific struct I'd just add a method to return the map representation if that's what you need. //jb On 21 Aug 2017, at 06:42, Tong Sun <suntong...@gmail.com<mailto:suntong...@gmail.com>> wrote: To covert a Go struct, say, type Person struct { First string Last string } into a map, him["First"]=... him["Last"]=... One way to do it is to marshall it into json then unmarhall it back. Is this the easiest way to do it? Is there any easier ways? Thanks -- 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<mailto:golang-nuts+unsubscr...@googlegroups.com>. For more options, visit https://groups.google.com/d/optout. -- 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. For more options, visit https://groups.google.com/d/optout.