The updated json is as follows:
{
"phone":[
{"home":"58878767"},
{"mobile":"32453543"}
],
"org": [
{
"current": {
"org_dept": "Hr",
"org_eptime": "1516354574432",
"org_name": "Uejsjak",
"org_title": "Hakosklaks"
}
},
{
"current": {
"org_dept": "Accounts",
"org_eptime": "1516354561184",
"org_name": "Abcd",
"org_title": "Hakahkshsjs"
},
{
"past": {
"org_dept": "Backend",
"org_eptime": "15163545",
"org_name": "Ab",
"org_title": "Hakah"
}
}
]
}
I am using the following code to print on the key and values:
personMap := make(map[string][]map[string]string)
json.Unmarshal([]byte(ii), &personMap)
for key, value := range personMap {
fmt.Println("index : ", key, " value : ", value){
}
The output I am getting is:
index: org value: [map["current":""],map["current":""]
How I can print every value of fields under field "current"?????
Now I am doing this:
personMap := make(map[string][]struct{Current map[string]string})
json.Unmarshal([]byte(ii), &personMap)
for key, value := range personMap {
fmt.Println("index : ", key, " value : ", value)
}
The output I am getting is:
index : org value : [{map[org_dept:Hr org_eptime:1516354574432 org_name:Uejsjak org_title:Hakosklaks]} {map[org_dept:Accounts org_eptime:1516354561184 org_name:Abcd org_title:Hakahkshsjs]}]
index : phone value : [{map[]} {map[]}]