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/ac267813-f553-4d65-b4eb-4642c640237an%40googlegroups.com.

Reply via email to