Golang 如何轉換 map key 是 struct 的 "json"
{
"map": {
{
"name": "js",
"age": 18
}: {
"id": 10,
"port": 1234
}
}
}
轉換成
type ST2 struct {
Id int `json:"id"`
Port int `json:"port"`
}
type ST1 struct {
Name string `json:"name"`
Age int `json:"age"`
}
type ST struct {
Map map[ST1]ST2 `json:"map"`
}
總之是收到了這么一個奇怪格式的“json”,正常決議方法肯定不行了,不知道還有沒有其他的庫什么的能用的
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/268958.html
標籤:go語言
下一篇:re正則運算式
