title: Decode very big json to array of structs
body: <p>I have a web application which have a REST API, get JSON as input and perform transformations of this JSON.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>func (a *API) getAssignments(w http.ResponseWriter, r *http.Request) {
  
     var document DataPacket
     err := json.NewDecoder(r.Body).Decode(&amp;document)
     if err != nil {
         a.handleJSONParseError(err, w)
        return
     }
  
     // transformations
  </code></pre>
  
  <p>JSON which I get is a <strong>collection</strong> of structs. External application use my application and send me very big json files (300-400MB). Decode this json at the one moment of time takes a very big time and amount of memory.</p>
  
  <p>Is there any way to work with this json as stream and decode structs from this collection one by one ?</p>