Reading and Writing JSON Data as Streams

Let’s learn how to read and write the JSON data as streams.

We'll cover the following

So far, we have seen working with single JSON records. But what happens when we have multiple records to process? This lesson answers this question and many more!

Imagine that we have a slice of Go structures that represent JSON records that we want to process. Should we process the records one by one? It can be done, but is it efficient? It does not! The good thing is that Go supports the processing of multiple JSON records as streams instead of individual records, which is faster and more efficient.

Coding example

This lesson teaches us how to perform that using the JSONstreams.go utility, which contains the following two functions:

Get hands-on with 1200+ tech skills courses.