Because they explicitly added a new line symbol when used Encoder.Encode. Here's the source code for this func, and it actually claims to add a newline to the documentation (see Comment, which is the documentation):
https://golang.org/src/encoding/json/stream.go?s=4272:4319#L173
func (enc *Encoder) Encode(v interface{}) error {
if enc.err != nil {
return enc.err
}
e := newEncodeState()
err := e.marshal(v)
if err != nil {
return err
}
e.WriteByte('\n')
if _, err = enc.w.Write(e.Bytes()); err != nil {
enc.err = err
}
encodeStatePool.Put(e)
return err
}
Now, why did the Go developers do it differently than "making the conclusion a little enjoyable"? One answer:
Streaming
Go json Encoder (, MB/GB/PB json data). , , . Encoder.Encode(), \n newline. , . io.Writer, v.
json.Marshal, , , , ( ) (, ajax POST- -) - , - 100- json ?). json.Marshal json - . 100 Marshal . Encoder.Encode() , , , io.Writer ..
, , , - Go, - Go. [n] vim \gb, .vimrc.