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 matching closing "}", including all its nested values. (Define a struct which contains all the nested attributes, for it to be deserialized into). If an io.Reader stream consists of a series of separate JSON objects - as yours does - then you get one object at a time. They don't have to be separated by whitespace or newlines, but they can be. Don't think about seeking. I don't know the internals of decoder.Decode(), but I would expect that it reads in chunks from the io.Reader. This means it will likely overshoot the object boundaries, but will buffer the excess and process it on the next call to Decode. -- 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/4faddcbc-1eb4-48f1-8320-fe9661811eeen%40googlegroups.com.