We have an interface object like below and Data looks below
[ map[com.org.exts.criteria.model.Sourceemployee:map[active:true ids:map[com.org.exts.criteria.model.employee.ids:map[alternateIds: alternateSubId:map[string:SomeValuestring] IDnumber: somefiledAssignedIds: familyId:map[int:111] MyAccountIds: ABCNumbers: OldIds: nrtNumbers: GHTNumb: Somefiledx: Somefiledx: Somefiledz:map[string:OldId1] somefiled779: someIds: somenumberfiled: someoriginid: someconsumerids:]
I can cast the interface as a map[string]interface{}, But when we do that the structure is nested with maps. Whats the best of iterating through all of the attributes within the interface object?
//My code looks below.
func (m *DataMapping) Map(rowMap *Datamapper.RowMap, previousRowValue map[string]interface{}) (buffer bytes.Buffer, err error) {
for stageKey := range previousRowValue {
stageKeyValueData := previousStageValue[stageKey]
// Some code for iterating through the map here is the challenge
}
}
We can cast the interface as a map[string]interface{} as mentioned in above code, But unable to navigate dynamically nested with maps. Trying to dynamically traverse through each attribute in map and able to update it.