utilities for returning json as a http response