I am using the below code to decode the json which I have hardcoded in the code but when I am trying to decode that I m not getting the all values.As I have mentioned the output of that code below.So please let me know is there any other way to decode this type of json and getting all key’s values.
package main
import (
“fmt”
“encoding/json”
)
type LogEntry struct {
filename string
functionname string
level int
LineNo int
msg string
time string
}
func main() {
var c LogEntry
result := `{"filename":"caches.go","functionname":"updateCaches","level":"info","lineno":31,"msg":"updating Caches","time":"2017-01-03T18:37:34+05:30"}`
err:=json.Unmarshal([]byte(result), &c)
if err!=nil{
fmt.Println("here is error",err)
}else{
fmt.Println("here is no error",c)
}