type MyStruct struct {
Value json.RawMessage `json:"value"`
}
var resp *http.Response
if resp, err = http.DefaultClient.Do(req); err == nil {
if resp.StatusCode == 200 {
var buffer []byte
if buffer, err = ioutil.ReadAll(resp.Body); err == nil {
mystruct = &MyStruct{}
err = json.Unmarshal(buffer, mystruct)
}
}
}
fmt.Println(string(mystruct.Value))
it produces something like:
\u003Chead>
\u003C/head>
\u003Cbody>
Doc at: http://golang.org/pkg/encoding/json/#Unmarshal
says: When unmarshaling quoted strings, invalid UTF-8 or invalid UTF-16 surrogate pairs are not treated as an error. Instead, they are replaced by the Unicode replacement character U+FFFD.
I kinda think this is what is going on. I just can't see the answer as my experience with go is minimal and I'm tired.