Answer the question
In order to leave comments, you need to log in
json parsing in go?
Good evening, you need to parse json like this:
type Packet struct {
Tunnel string
Message string
}
func main() {
data := []byte(`{tunnel: "AS646484PNKL", message: {username: "Sireax", message: "Hello"}}`)
// ... Дальше должен произойти парсинг
// json tunnel -> packet tunnel
// json message должен так и остаться в виде строки и попасть в packet message
//
// Должно получиться что-то в виде этого:
// packet.tunnel -> "AS646484PNKL"
// packet.message -> "{username: "Sireax", message: "Hello"}"
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question