Closed
Description
What version of Go are you using (go version
)?
$ go version go version go1.14.1 windows/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env set GO111MODULE=on set GOARCH=amd64 set GOBIN= set GOEXE=.exe set GOFLAGS= set GOHOSTARCH=amd64 set GOHOSTOS=windows set GOINSECURE= set GONOPROXY= set GONOSUMDB= set GOOS=windows
What did you do?
This issue is actually a separate issue from discussions below #38126.
type T struct {
F1 string `json:"F1,string"`
}
t := T {
"aaa\tbbb",
}
b, _ := json.Marshal(t)
fmt.Println(string(b))
What did you expect to see?
Before go 1.14:
{"F1":"\"aaa\\tbbb\""}
Autually I'm not sure which of the output results is correct. I think it was introduced by 0e015e20 but I don't know why it has to be changed like that. I want to figure out which of them exactly match the godoc's description:
The "string" option signals that a field is stored as JSON inside a JSON-encoded string
What did you see instead?
After go1.14:
{"F1":"\"aaa\tbbb\""}