I'm having some problem reading this type of json.
["Msg",{"cmd":"ack","id":"B81DA375B6C4AA49D262","ack":2,"from":"18094158994@c.us","to":"18099897215@c.us","t":1555446115}]
i try with many libraries.
type SEND struct {
Mgs string `json:"Msg"`
//SEND MSG
}
type MSG struct {
CMD string `json:"cmd"`
ID string `json:"id"`
ACK int `json:"ack"`
FROM string `json:"from"`
TO string `json:"to"`
T int64 `json:"t"`
}
func main() {
data := `["Msg",{"cmd":"ack","id":"B81DA375B6C4AA49D262","ack":2,"from":"18094158994@c.us","to":"18099897215@c.us","t":1555446115}] `
var dd SEND
err := json.Valid([]byte(data))
fmt.Println("Is valid XML?->", err)
json.Unmarshal([]byte(data), &dd)
fmt.Println("1", dd)
fmt.Println("2", dd.Mgs)
}
Al always a receive empty and the json it's valid
Is valid XML?-> true
1 {}
2 EMPTY