How to access - for example: `json:"Field Name"` - struct tags in front of every struct field definition?

I hava a struct:

type User struct {
    Id   int  `json:"Id"`
}    

So How to access to struct tag json:"Id" itself?

Using reflection, where the tag is an attribute of the struct field.

https://golang.org/pkg/reflect/#StructField

1 Like

Thank you.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.