Hi Nick, I understand , please check if this pkg may help you https://github.com/fatih/structs,
Thanks On Monday, May 17, 2021 at 2:58:54 PM UTC+5:30 Amnon wrote: > https://programmersought.com/article/93641771999/ > > On Monday, 17 May 2021 at 10:26:14 UTC+1 nick....@gmail.com wrote: > >> Is there an easy way to go from a map to a struct and vice versa? e.g. >> going from: >> m := map[string]interface{}{"a": "x", "b": 5} >> >> to an instance of: >> type T struct { >> A string >> B int >> } >> >> I can do this going through JSON (marshal the map, unmarshal into struct), >> but is there a more direct way? >> > -- 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/6b39efc9-c12f-4474-833a-b4cee80876abn%40googlegroups.com.