#Streaming
2 articles
09 How To Use Streaming Encoder
Introduction to Stream Encoders
Apart from JSON Decoder, this JSON package can also support Encoder which is used directly JSON into io.Writer
. So that way we don’t need to store the JSON data first into a string
or []byte
variable, so we can just write it directly into io.Writer
.
08 How To Use Streaming Decoder
Introduction to Stream Decoder
In the previous article, we studied the JSON package by using conversion of JSON data which was already in the form of variables and string data or we used []byte
. Sometimes the JSON data comes from input in the form of io.Reader, which can be in the form of a file, network or request body. So we could just read all the data first, then store it in a variable and then convert it from JSON, but we don’t need to do this because the JSON package has a feature for reading data from Stream
.