Failed to convert value (type js.Value) to type map[string]interface{}

In my WASM code, I’m getting a js.Value that is a JavaScript object, and shown here the JavaScript object is mapping with GO map[string]interface{}

In my code, I tried the below to get the data from the returned object, getting use from this code that is converting JSON to map[string]interface{}:

	ReadAll = js.FuncOf(func(this js.Value, args []js.Value) interface{} {
		// defer ReadAll.Release()
		cursor := this.Get("result")

		if cursor.Truthy() {
			_ = cursor.Get("key")
			value := cursor.Get("value")

			// Decode incoming json
			jsonMap := make(map[string]interface{})
			json.Unmarshal([]byte(value), &jsonMap)

			//	var content []map[string]interface{}
			//	json.Unmarshal([]byte(jsonMap["name"].(string)), &content)

			Window.Call("alert", jsonMap)
			cursor.Call("continue")

		} else {
			Window.Call("alert", "No more records")
		}
		return nil
	})

But i got the error:

./cursor.go:20:25: cannot convert value (type js.Value) to type byte

I was able to get it using value.Get(), below the new code:


		if cursor.Truthy() {
			key := cursor.Get("key")
			value := cursor.Get("value")

			data := fmt.Sprintf("Name for id %v is %v, Age: %v, Email: %v", key,
				value.Get("name"), value.Get("age"), value.Get("email"))

            // Equivalent JavaScript code:
			// alert("Name for id " + cursor.key + " is " + cursor.value.name + ", Age: "
			// + cursor.value.age + ", Email: " + cursor.value.email);

			Window.Call("alert", data)
			cursor.Call("continue")

		} else {
			Window.Call("alert", "No more records")
		}