I want to put my map data to another map data using Golang. however it has struct type.
Here is my code.
birth := make(map[string]interface{})
birth["docType"] = "registerBirth"
birth["agencyCd"] = string(args[0])
birth["birthYmd"] = string(args[1])
birth["lsTypeNm"] = string(args[2])
birth["monthDiff"] = string(args[3])
birth["nationNm"] = string(args[4])
birth["sexNm"] = string(args[5])
birth["regType"] = string(args[9])
birth["regYmd"] = string(args[10])
I want to put this map data to another map but I want to use struct type.
cattle := make(map[string]interface{})
cattle["docType"] = "information"
cattle["birthInfo"] = struct {
birth map[string]interface{}
}{
birth,
}
but, when I get data.. It comes out like this.
{"birthInfo":{},"docType":"information"}
Here Is the example that I want.
"birthInfo": {
"birthYmd": "2018-07-25",
"cattleNo": "cow001",
"docType": "registerBirth",
"farmNo": "farm001",
"flatEartagNo": "eartag123123",
"lsTypeNm": "황소",
"monthDiff": "2018-07",
"nationNm": "austria",
"regType": "직접",
"regYmd": "20185-07-25",
"sexNm": "M"
},
"docType": "information",
...
Thanks in advance.