This is a creation in Article, where the information may have evolved or changed. Can edit this code!
Click here and start typing.
Package Main
Import "FMT"
Import "Encoding/json"
Type Channeloperator struct {
Oid string
Aid string
Name string
Isonline BOOL
Msgchan Chan string ' JSON: "-" '
}
Type channeloperators struct {
Op []channeloperator
}
Func Main () {
Fmt. Println ("Hello, World")
MM: = Make (Map[string]*channeloperator)
mm["123"] = &channeloperator{oid: "12312"}
mm["5678"] = &channeloperator{oid: "12312"}
B, _: = json. Marshal (mm)
Fmt. Println (string (b))
c: = channeloperators{}
C.op = Append (C.op, channeloperator{oid: "12312"})
X, Err: = json. Marshal (c)
If err! = Nil {
Fmt. PRINTLN (ERR)
}
Fmt. Println (String (x))
}
Hello, World {"123": {"oid": "12312", "Aid": "", "Name": "", "Isonline": false}, "5678": {"oid": "12312", "Aid": "", "Name": "," Isonline ": false}}{" Op ": [{" Oid ":" 12312 "," Aid ":" "," Name ":" "," Isonline ": false}]}