Instead of greedily reading the whole stream in memory and passing it to json.Unmarshal
:
json.Unmarshal(bigBlobOfData, &myStruct)
We can delegate the stream reading to our dear masters of golang:
json.NewDecoder(myIOReader).Decode(&myStruct)
And read multi giga(tera?)bytes files with no sweat. Also works with xml.NewDecoder
.
Top comments (0)