im using the following code without success to parse json value but its inside array []
https://play.golang.org/p/5HdWeyEtvie
package main
import (
"encoding/json"
"fmt"
)
var input = `
[
{
"created_at": "Thu May 31 00:00:01 +0000 2012"
},
{
"created_at": "Thu May 31 00:00:01 +0000 2012"
}
]
`
func main() {
var val map[string]interface{}
if err := json.Unmarshal([]byte(input), &val); err != nil {
panic(err)
}
fmt.Println(val)
}
The idea is to get the value as key and print it , like a function that get string parameter="created_at" and prints it.