Answer the question
In order to leave comments, you need to log in
How to force json in golang not to replace &?
q=20971520
f.Value = fmt.Sprintf("INTERNET?POSTpaid=%d/8&PREpaid=%d/8", q, q)
print f.Value, get what I want INTERNET?POSTpaid=20971520/8&PREpaid=20971520/8
marshal f, I get
"Value":"INTERNET?POSTpaid=20971520/8\u0026PREpaid=20971520/8"
I can't figure out how to escape. Or what to do in general
`json:",string"` does not help
Answer the question
In order to leave comments, you need to log in
https://golang.org/pkg/encoding/json/#Marshal
"String values encode as JSON strings coerced to valid UTF-8, replacing invalid bytes with the Unicode replacement rune. The angle brackets "<" and ">" are escaped to "\u003c" and "\u003e" to keep some browsers from misinterpreting JSON output as HTML. Ampersand "&" is also escaped to "\u0026" for the same reason."
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question