[go-nuts] Re: array json streaming inside json object

2020-02-20 Thread Amnon Baron Cohen
https://github.com/golang/go/issues/33714 is related. The problem you describe is far greater when decoding. On Friday, 21 February 2020 05:06:58 UTC, Jérôme LAFORGE wrote: > > Thank you both. > > When I am the designer of API that must stream json array, I use JSONL. > And it is much easier to

[go-nuts] Re: array json streaming inside json object

2020-02-20 Thread Jérôme LAFORGE
Thank you both. When I am the designer of API that must stream json array, I use JSONL. And it is much easier to use it as sender. Unfortunately, in this case, I can't modify the API. I read somewhere (I can't remember where), that somebody plans to work on simplicity for streaming json object

[go-nuts] Re: array json streaming inside json object

2020-02-20 Thread Brian Candler
There is even a "standard" for this: http://jsonlines.org/ -- 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

[go-nuts] Re: array json streaming inside json object

2020-02-20 Thread Amnon Baron Cohen
Unfortunately there is not a more elegant way. Unless you change the protocol, and dispense with the idea of returning a single json object, and instead return line delimited streaming json. Then you can dispense with injecting brackets into your stream, and just call enc.Encode(doc) w.Writ