Re: [go-nuts] Json Parse Data [unexecpted non whitespace 1 to 28]

2020-04-28 Thread Marcin Romaszewicz
Ali, your example has several problems. First, you do this: var p Person data, err := json.Marshal(p); if err != nil{ fmt.Println("Error", err) } What this does is encode an empty object, that's fine. Next, you read the HTTP body from the request, and try to unmarshal that. fmt.Println("Data",

[go-nuts] Json Parse Data [unexecpted non whitespace 1 to 28]

2020-04-28 Thread Ali Hassan
[image: Capture.JPG] Data : TYPE OF Json var member Member // struct where json data, err :=json.Marshall(member); if err != nil{ fmt.Printf("Error %s",err )} fmt.Printf("Data", data) err = json.NewDecoder(request.Body).Decode(&member); if err != nil {fmt. Printf("Error %s",err) // this is