def parse ( self , data , mimetype ) : encoding = mimetype . params . get ( 'charset' ) or 'utf-8' return json . loads ( data . decode ( encoding ) )
unsupported media type json python
Parses a byte array containing a JSON document and returns a Python object . : param data : The byte array containing a JSON document . : param MimeType mimetype : The mimetype chose to parse the data . : return : A Python object .
def parse(self, data, mimetype):
        """
        Parses a byte array containing a JSON document and returns a Python object.
        :param data: The byte array containing a JSON document.
        :param MimeType mimetype: The mimetype chose to parse the data.
        :return: A Python object.
        """
        encoding = mimetype.params.get('charset') or 'utf-8'

        return json.loads(data.decode(encoding))