How to join multiple array into single value json?

Hi All, I have nested JSON value, how could I join them into a single value json like these? Thank you for your help

data := gjson.GetMany(json, "results.0.series.#.tags.host", "results.0.series.#.values.1.1")
fmt.Println(data)
result:
    [
       "service-a",
       "service-b",
    ]
    [
       0.02501250625561197,
       0.1251251251165223,
    ]

expected:
[
   {
       "service-a": "0.02501250625561197",
       "service-b": "0.1251251251165223",
    }
]

I have created some iteration like this but still failed.

var m map[string]interface {}
	for k, v := range value {
		m[data[k]] = v
	}

	fmt.Println(m)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.