Simplify call to Write in serveJson
Ensure that http 500 will be sent to client if template panics

* This comes from lassieco on #go-nuts