If you can guarantee your input is always pretty printed like that, you
could use bufio with a custom splitfunc to match `\n{`, no need to double
parse json
On Sunday, March 28, 2021 at 11:35:20 PM UTC+2 greg.sa...@gmail.com wrote:
>
> I've tried this suggestion and although its certainly a bit
I've tried this suggestion and although its certainly a bit more
refactoring then I expected - the outcome looks to be exactly as you
described here.
Thank you so much for the suggestion, take a bow!
- Greg
On Sunday, March 28, 2021 at 12:15:34 PM UTC-7 Brian Candler wrote:
> No, it's even
No, it's even simpler than that:
* The first call to decoder.Decode() will return the first object in the
stream.
* The second call to decoder.Decode() will return the second object in the
stream.
* And so on...
By "object" I mean top-level object: everything between the opening "{" and
its ma
The inner blob is expecting an io.Reader. But, perhaps I can change that
to pass a Decoder based on what you are saying. For some reason I hadn't
grokked that is how Decoder was working. Just to re-iterate what I think
you are saying (and in case anyone stumbles across this thread later),
a
> This works, but the downside is that each {...} of bytes has to be pulled
into memory. And the functions that is called is already designed to
receive an io.Reader and parse the VERY large inner blob in an efficient
manner.
Is the inner blob decoder actually using a json.Decoder, as shown in