I want to unmarshal a string that contains JSON,
however the Unmarshal function takes a []byte as input.
How can I convert my UTF8
just use []byte(s) on the string. for example:
package main
import (
    "encoding/json"
    "fmt"
)
func main() {
    s := `{"test":"ok"}`
    var data map[string]interface{}
    if err := json.Unmarshal([]byte(s), &data); err != nil {
        panic(err)
    }
    fmt.Printf("json data: %v", data)
}
check it out on the playground here.