Ring middleware for handling JSON