I'm trying to get the path to value from a json file:

for example :

x: 4
z:
  y: 6
  t: 8
a:
  b:
    p: 0
m:
  c : 4 

the output that i want is :

x=4, z.y=6, z.t=8, a.b.p=0, m.c=4

i wrote a functions below :

func parsecustom(aMap map[string]interface{}) (string, string) {

    var sol string
    var k string
    for key, val := range aMap {
        switch concreteVal := val.(type) {
        case map[string]interface{}:
            x, _ := parseMap(val.(map[string]interface{}))
            sol = key + "." + x
            k += sol + ","
        case string:
            sol = key + "=" + concreteVal + " "
            k += sol + ","
        case float64:
            sol = key + "=" + strconv.FormatFloat(concreteVal, 'f', -1, 64) + " "
            k+= sol + ","
        default:
            k = " "

        }
    }

return sol, TrimSuffix(k, ",")
}

but it didn't take into account this case :

z:
  y: 6
  t: 8

it override, it print only z.t=8 and ignore z.y=6

Any hints please how to solve this problem