block by joyrexus bc2ab8815cd278d42171

parse JSON request

Simple demo of how to decode JSON data coming from an http POST request.

Run the server with go run server.go and then make a curl request:

. post.sh

… or …

curl -d @- http://localhost:8080/user
{
  "name": {
    "first": "Bob",
    "last":  "Jones"
  }
}
# CTRL-D

You should get back:

Hi Bob Jones!

For more about JSON and Go, see this blog post, or this example code.

post.sh

server.go