On Fri, 9 Aug 2019, at 3:33 PM, Jonathan Hall wrote: > *I debated posting here, or straight to GitHub. If that's the better place, I > can move the thread there. * I have long wanted proper streaming support in > the `encoding/json` library. Lately I’ve been doing some digging to > understand the current state of things, and I think I’ve come to grips with > most of it.
> > A number of previous issues relate to this topic: > https://github.com/golang/go/issues/7872, > https://github.com/golang/go/issues/11046, > https://github.com/golang/go/issues/12001, > https://github.com/golang/go/issues/14140 > > I have read through each of these issues, and believe I have a fair > understanding of the problems associated with streaming JSON input/output. If > I'm overlooking something please enlighten me. > > In a nutshell: The library implicitly guarantees that marshaling will never > write an incomplete JSON object due to an error, and that during > unmarshaling, it will never pass an incomplete JSON message to > `UnmarshalJSON`. > > Work toward this was done about 3 years ago, on this CL: > https://go-review.googlesource.com/c/go/+/13818/ > Workt was eventually abandoned, apparently when the author was unsure how to > make the new behavior opt-in. I believe this proposal will solve that issue. You may also be interested in a CL I created last year to add an unbuffered write mode to the encoder https://go-review.googlesource.com/c/go/+/135595 I think I addressed all the review comments but it stalled behind a tangential issue around the current version's use of sync.Pool https://github.com/golang/go/issues/27735 Ian -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/70e5a2a1-70bf-4917-81c5-6504e110d9b2%40www.fastmail.com.