Add a json body to the request.   
        
        :param data: A json string, a dict, or a list of key, value pairs
        :param params: A dict of key value pairs to JSON encode

def with_json(self, data=None, **params):
        """
        Add a json body to the request.   
        
        :param data: A json string, a dict, or a list of key, value pairs
        :param params: A dict of key value pairs to JSON encode     
        """
        if isinstance(data, (tuple, list)):
            data = dict(data)

        if params:
            # data must be None or able to be a dict
            if isinstance(data, dict):
                data.update(params)
            elif data is None:
                data = params
            else:
                raise ValueError('Data must be None or a dict if used with params, got: %r' % data)

        req = self.with_headers({'Content-Type': 'application/json', 'Accept': 'application/json'})
        if isinstance(data, basestring):
            # Looks like it's already been encoded
            return req.with_body(data)
        else:
            return req.with_body(json.dumps(data))