I know that the context context, gorotine in a way of information transmission, or operation gorotine,,
Json is information transmission between the framework can be format,
What the hell is going on the context to play
` ` `
Func main () {
Type PP struct {
The Context Context. The Context ` json: "Context" `
}
Cancel, _ :=context. WithCancel (context. The Background ())
P1: PP={
Context: cancel,
}
Result, err:=json. MarshalIndent (p1, ""," ")
if err ! Nil={
FMT. Println (err)
Panic (" serialization failure ")
} else {
FMT. Println (" serialization result: : ")
FMT. Println (string) (result)
}
//deserialization
P2: PP={}
Err2:=json. The Unmarshal (result, & amp; P2)
If err2! Nil={
FMT. Println (err2)
Panic (" deserialization failure ")
} else {
FMT. Println (" reverse sequence words results: : : ")
FMT. Println (p2)
}
}
` ` `
CodePudding user response:
Deserialization, shape is to replace all the parameters, to parse the data type of the object