I am a new Go Language programmer. Below is my program but I am getting this error:
#command-line-arguments
.\helloworld.go:20: undefined: json.Marshall
Can anyone tell why I get the error?
package main
import (
"encoding/json"
"fmt"
"net/http"
)
type API struct {
Message string "json:message"
}
func main() {
http.HandleFunc("/api", func(w http.ResponseWriter, r *http.Request) {
message := API{"Hello, World!!!"}
output, err := json.Marshall(message)
if err != nil {
fmt.Println("Something went wrong")
}
fmt.Fprintf(w, string(output))
})
http.ListenAndServe(":8080", nil)
}