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", data) err = json.NewDecoder(r.Body).Decode(&p);if err != nil{ fmt.Println("Error2", err) return } We have no idea what you're sending. If you are issuing a GET, there will be no reasonable body, and the JSON parser will correctly tell you that there is no data. Did you mean to initialize NewDecoder with "data"? If you do so, your example works. In order for your code to work properly, you need to do an HTTP POST to /data on your handler with a JSON payload conforming to Person's schema. On Tue, Apr 28, 2020 at 1:54 AM Ali Hassan <alidevelope...@gmail.com> wrote: > [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 print "EOF"} > > unexpected non whitespaceing json parse data 1 to colummn 28 > > > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/950a3753-88bf-4748-ab58-e59707914b67%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/950a3753-88bf-4748-ab58-e59707914b67%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CA%2Bv29LvhTSvLtH7emnVpPjS%3Ddfzs8o1CiybzU4QgZ2bVYeUg8A%40mail.gmail.com.