1
0
mirror of https://github.com/json-iterator/go.git synced 2025-11-29 22:47:28 +02:00

struct encoder

This commit is contained in:
Tao Wen
2017-01-09 19:19:48 +08:00
parent 5b0609f901
commit 552afb3625
8 changed files with 336 additions and 50 deletions

View File

@@ -31,6 +31,7 @@ func Marshal(v interface{}) ([]byte, error) {
buf := &bytes.Buffer{}
stream := NewStream(buf, 4096)
stream.WriteVal(v)
stream.Flush()
if stream.Error != nil {
return nil, stream.Error
}