Skip to content

Instantly share code, notes, and snippets.

@sethamclean
Created March 18, 2014 00:05
Show Gist options
  • Save sethamclean/9611022 to your computer and use it in GitHub Desktop.
Save sethamclean/9611022 to your computer and use it in GitHub Desktop.
A small json example using empty interface
package main
import (
"encoding/json"
"fmt"
)
func main() {
var i interface{}
json_data := `{
"employees": [
{ "firstName":"John" , "lastName":"Doe" },
{ "firstName":"Anna" , "lastName":"Smith" },
{ "firstName":"Peter" , "lastName":"Jones" }
]
}`
bytes := []byte(json_data)
json.Unmarshal(bytes, &i)
fmt.Println(i)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment