We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
go playground 1.23
go env
# go playground environment
https://go.dev/play/p/c9Sgv-KJzku
Encoded the same message using json.NewEncoder(buffer).Encode(msg) and json.Marshal(msg) and then compared both outputs.
json.NewEncoder(buffer).Encode(msg)
json.Marshal(msg)
The comparation gave false, json.Marshal() doesn't append a newline, .Encode() does, I don't know which one should be correct.
json.Marshal()
.Encode()
I really don't know what should be the correct output, I expected to see the same output in both functions.
The text was updated successfully, but these errors were encountered:
Related Issues and Documentation
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
Sorry, something went wrong.
both are working as intended.
No branches or pull requests
Go version
go playground 1.23
Output of
go env
in your module/workspace:# go playground environment
What did you do?
https://go.dev/play/p/c9Sgv-KJzku
Encoded the same message using
json.NewEncoder(buffer).Encode(msg)
andjson.Marshal(msg)
and then compared both outputs.What did you see happen?
The comparation gave false,
json.Marshal()
doesn't append a newline,.Encode()
does, I don't know which one should be correct.What did you expect to see?
I really don't know what should be the correct output, I expected to see the same output in both functions.
The text was updated successfully, but these errors were encountered: