FAQ
Actually they added the ability to stream-decode arrays and objects (in
1.5, I think): https://godoc.org/encoding/json#example-Decoder-Decode-Stream
On Wed, Dec 2, 2015 at 1:56 PM Travis Keep wrote:

many thanks.

On Wednesday, December 2, 2015 at 12:20:12 PM UTC-8, alb.do...@gmail.com
wrote:
It's a known problem.
Se discussion on https://github.com/golang/go/issues/7872


On Wednesday, December 2, 2015 at 8:48:02 PM UTC+1, Travis Keep wrote:

Just curious, is there an architectural reason that the JSON encoder is
not streaming?
On Wednesday, December 2, 2015 at 11:40:18 AM UTC-8, Caleb Spare wrote:

I am writing this post because it seems that the GO JSON encoder is
not a truly streaming encoder.

No it isn't, nor does it claim to be (that I can find).

The encoder marshals (and buffers) an entire object at a time. If you
have a slice of 10k items you want to send as a JSON array, you can do
the array encoding yourself: send a "[", then encode each item with a
"," in between, then a final "]".

http://play.golang.org/p/NTLgY2CRXp

-Caleb
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 7 of 7 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedDec 2, '15 at 7:09p
activeDec 4, '15 at 3:17a
posts7
users4
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase