jsonhttp: new package

This factors out some functionality from the charm store that makes
it easier to write JSON-returning HTTP handlers, without tying
it to a specific representation of error responses.

As discussed, we'll leave it as is for now and perhaps in a future PR wrap the ResponseWriter in a type that returns an error from Write and WriteHeader