Last active
August 29, 2015 14:09
-
-
Save gwilym/1e5223fd455a557aad8c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "bufio" | |
| "encoding/json" | |
| "os" | |
| ) | |
| type LazyEntry struct { | |
| Timestamp string `json:"timestamp"` | |
| Context json.RawMessage `json:"context"` | |
| Event string `json:"event"` | |
| Properties json.RawMessage `json:"properites"` | |
| AnonymousID string `json:"anonymousId"` | |
| } | |
| type FullEntry struct { | |
| Timestamp string `json:"timestamp"` | |
| Context map[string]interface{} `json:"context"` | |
| Event string `json:"event"` | |
| Properties map[string]interface{} `json:"properites"` | |
| AnonymousID string `json:"anonymousId"` | |
| } | |
| func main() { | |
| var entry LazyEntry | |
| scanner := bufio.NewScanner(os.Stdin) | |
| for scanner.Scan() { | |
| json.Unmarshal([]byte(scanner.Text()), &entry) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment