title: Golang, Decoding json into custom structure
body: <p>I'm trying to pull reddit content from the json API into a custom structure for the client. the structure i've come up with in go for this is </p>
  
  <pre><code>type Subreddit struct {
          offset int
          num_of_posts int
          subscribers: int
          thumbnail string
          children []post
  }
  
  type post struct {
          type string
          url string
          thumbnail string
          submitted_by string
          upvotes int
          downvotes int
  }       
  </code></pre>
  
  <p>unfortunately the reddit json isn't formatted even close to this and in addition i'll want to filter out url's i can't support etc. </p>
  
  <p>The only way i know to do it this is to create an interface for each of the "children" in the source data, and iterate through each child manually, creating an individual "post" for each interface. and pushing them into the subreddit object's post array. </p>
  
  <p>For reference the data is formatted like <a href="http://www.reddit.com/r/web_design/.json" rel="nofollow">http://www.reddit.com/r/web_design/.json</a></p>
  
  <p>Is this the right way to do this? Or is there a faster way. It seems like a lot of overhead for such a small task, but i'm a PHP Javascript dev, so It's just unusual for me I suppose. </p>