Skip to content

Instantly share code, notes, and snippets.

@gwilym
Last active August 29, 2015 14:09
Show Gist options
  • Save gwilym/1e5223fd455a557aad8c to your computer and use it in GitHub Desktop.
Save gwilym/1e5223fd455a557aad8c to your computer and use it in GitHub Desktop.
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