jflect
jflect copied to clipboard
Minor Trouble with Reddit feeds
Hey str1ngs, thanks so much for jflect! It's incredibly useful.
Not sure if you are still interested in working on it, but thought I'd share this just in case? Here's a feed scraped from Reddit today:
https://storage.googleapis.com/bt-public/misc/jflect-sample.json
I included jflect's output below. To get golang to parse the feed, a couple changes are required:
-
Editedmust be changed frombooltointerface{}. (That's because sometimes it'sfalseand sometimes it's a float. Lame, I agree) -
CreatedandCreatedUtcmust be changed frominttofloat64
type Reddit struct {
Data struct {
After string `json:"after"`
Children []struct {
Data struct {
Archived bool `json:"archived"`
Author string `json:"author"`
Clicked bool `json:"clicked"`
Created int `json:"created"`
CreatedUtc int `json:"created_utc"`
Domain string `json:"domain"`
Downs int `json:"downs"`
Edited bool `json:"edited"`
Gilded int `json:"gilded"`
Hidden bool `json:"hidden"`
Id string `json:"id"`
IsSelf bool `json:"is_self"`
MediaEmbed struct{} `json:"media_embed"`
ModReports []interface{} `json:"mod_reports"`
Name string `json:"name"`
NumComments int `json:"num_comments"`
Over18 bool `json:"over_18"`
Permalink string `json:"permalink"`
Saved bool `json:"saved"`
Score int `json:"score"`
SecureMediaEmbed struct{} `json:"secure_media_embed"`
Selftext string `json:"selftext"`
Stickied bool `json:"stickied"`
Subreddit string `json:"subreddit"`
SubredditId string `json:"subreddit_id"`
Thumbnail string `json:"thumbnail"`
Title string `json:"title"`
Ups int `json:"ups"`
Url string `json:"url"`
UserReports []interface{} `json:"user_reports"`
Visited bool `json:"visited"`
} `json:"data"`
Kind string `json:"kind"`
} `json:"children"`
Modhash string `json:"modhash"`
} `json:"data"`
Kind string `json:"kind"`
}