How to define a json struct type for function signature?
I have a struct definition
type ds struct {
name string
TagList []struct {
Key string `json:"Key"`
Value string `json:"Value"`
} `json:"TagList"`
}
I want to have a function that converts the TagList into string arrays (my own serialization function). So the function will look like this
func serialize(tagList开发者_JS百科 <?>) string
What I should define as the type <?> is what I am not sure about. Because if I called this function using
serialize(mydata.TagList) // mydata is the ds struct type
Then it will remind me that this type is []struct{...}
But I am not sure how to define the []struct{...}.
I am also open for existing serialization library apis i can use to do this as long as it serialized into a string.
精彩评论