import json
import logging


def extract_from_json(req_raw):
    """
    Extract a Python object from a raw JSON and return it.
    :param req_raw: Encoded JSON string
    :type req_raw: bytes
    :returns: A python object.
    :rtype: object
    """
    try:
        req_str = req_raw.decode("utf-8")
        obj = json.loads(req_str)
        return obj
    except (UnicodeDecodeError, json.JSONDecodeError) as e:
        logging.error('Error decoding request: %s' % e)
        return None