title: Unmarshall flat JSON into a nested struct in Go
body: <p>There is a nested struct that I want to create from a flat JSON that includes another struct:</p>
  <pre><code>type Todo struct {
      Todo_id   int    `json:&quot;todo_id&quot; db:&quot;todo_id&quot;`
      Todo_name string `json:&quot;todo_name&quot; db:&quot;todo_name&quot;`
  
      User_id int         `json:&quot;user_id&quot; db:&quot;user_id&quot;`
      Subs    []Sub       `json:&quot;subs&quot; db:&quot;subs&quot;`
      Times   Parsed_Time `json:&quot;times&quot; db:&quot;times&quot;`
  }
  </code></pre>
  <p>When I unmarshal a JSON I receive a &quot;missing destination name deadline&quot; error because Deadline is inside a Parsed_Time struct. Is there a way to custom unmarshal JSON so that parts of the JSON would be omitted without error? I would like to separately create a Todo struct with an empty Times, then run Unmarshal again to extract deadline and the rest of timestamps separately into another struct. This is to avoid making two separate Get requests to a database.</p>