Allow JSON responses to be compressed

Fixes #486