encoding/json: Unintuitive behavior when using custom UnmarshalText #38947
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, it even seems like it was introduced somewhere between
go1.13.9
andgo1.14.2
.What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I was trying to Unmarshal a JSON body containing
\n
into amap[String]string
whereString
isTextUnmarshaler
:JSON body:
An example can be found here: https://play.golang.org/p/V7qY2khOcgH
Note, my key issue is the difference in behavior between the two maps in the playground example.
What did you expect to see?
A normal map without escaped quotes. Which is the result of using a
map[string]string
instead of amap[String]string
.What did you see instead?
Escaped quotes in the map keys. As if the key wasn't properly tokenized.
The text was updated successfully, but these errors were encountered: