如何将字符串转换为JSON obj? [重复]

This question already has an answer here:

Below is the code that I've tried but to no avail:

    jsonObj, err := json.Marshal(supportJSONString)
    if err != nil {
        http.Error(w, err.Error(), http.StatusInternalServerError)
    }
    fmt.Fprintf(w, "%s", jsonObj)
</div>

Its already a json object. All you need to do is

jsonObj := []byte(supportJsonString)

You can then return it as HTTP response. But in the most generic case, you would want to create a struct as response object and the marshal it to json instead of using strings this way.