Convenience middleware for sending JSON