Skip to content

Instantly share code, notes, and snippets.

@julianshen
Created September 13, 2015 08:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julianshen/ba805faa6f2ff41fc139 to your computer and use it in GitHub Desktop.
Save julianshen/ba805faa6f2ff41fc139 to your computer and use it in GitHub Desktop.
package main
import (
"encoding/json"
"fmt"
"os"
)
func main() {
type User struct {
ObjectId, SessionToken, Username string
}
type Data struct {
Results []User
}
fileReader, err := os.Open("_User.json")
if err != nil {
panic(err)
}
defer fileReader.Close()
dec := json.NewDecoder(fileReader)
var data Data
dec.Decode(&data)
for _, m := range data.Results {
fmt.Printf("%v: %v: %v\n", m.ObjectId, m.Username, m.SessionToken)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment