访问通过POST从文件接收的JSON

I'm building a RESTful API using Martini and have a hard time accessing the contents of book.json sent to my service via

curl -X POST "http://localhost:8080/books" -H "Content-Type: application/json" -d @book.json

book.json is not a binary file but a simple text file containing a JSON array. How can I access the transmitted JSON? PostForm on the http.Request is empty.

You probably have data in request.Body that you can demarshal. Imho this aticle explains well the problem: http://nathanleclaire.com/blog/2013/11/30/fear-and-loathing-with-golang-and-angular-js/

I know this is old but you are probably looking for Martini Binding

https://github.com/martini-contrib/binding

m.Post("/contact/submit", binding.Bind(ContactForm{}), func(contact ContactForm) string {
    return fmt.Sprintf("Name: %s
Email: %s
Message: %s",
        contact.Name, contact.Email, contact.Message)
})