Skip to content

Instantly share code, notes, and snippets.

@bgnori
Created April 10, 2016 14:01
Show Gist options
  • Save bgnori/ed0dd6e402781c68bad8bca15df2cc27 to your computer and use it in GitHub Desktop.
Save bgnori/ed0dd6e402781c68bad8bca15df2cc27 to your computer and use it in GitHub Desktop.
package main
import (
"encoding/json"
"fmt"
"os"
)
type LINEContent struct {
ToType int `json:"toType"`
CreatedTime int `json:"createdTime"`
From string `json:"from"`
Id string `json:"id"`
To []string `json:"to"`
ContentMetadata map[string]string `json:"contentMetadata"`
Location string `json:"Location"`
Text string `json:"text"`
ContentType int `json:"contentType"`
Seq string `json:"seq"`
}
type LINEResultItem struct {
Id string `json:"id"`
CreatedTime int `json:"createdTime"`
EventType string `json:"eventType"`
From string `json:"from"`
FromChannel int `json:"fromChannel"`
ToChannel int `json:"toChannel"`
To []string `json:"to"`
Content LINEContent `json:"content"`
}
type LINEPack struct {
Result []LINEResultItem `json:"result"`
}
func main() {
var x LINEPack
var i int
i = 1462499114
fmt.Printf("%d\n", i)
decoder := json.NewDecoder(os.Stdin)
decoder.Decode(&x)
fmt.Printf("%+v\n", x)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment