jazzband/sorl-thumbnail · helpers.py
python logo
def deserialize(s):
    if isinstance(s, bytes):
        return json.loads(s.decode('utf-8'))
    return json.loads(s)
Similar code snippets
1.
adewes/blitzdb · serializers.py
Match rating: 76.99% · See similar code snippets
python logo
def deserialize(cls, data):
        if six.PY3:
            return json.loads(data.decode('utf-8'))
        else:
            return json.loads(data.decode('utf-8'))
2.
siznax/wptools · utils.py
Match rating: 69.04% · See similar code snippets
python logo
def json_loads(data):
    """
    python-version-safe json.loads
    """
    try:
        return json.loads(data, encoding='utf-8')
    except TypeError:
        return json.loads(data.decode('utf-8'))
3.
ClericPy/torequests · _py3_patch.py
Match rating: 67.67% · See similar code snippets
python logo
def json(self, encoding=None, loads=json.loads):
        return loads(self.content.decode(encoding or self.encoding))
4.
kevin1024/vcrpy · __init__.py
Match rating: 67.51% · See similar code snippets
python logo
async def json(self, *, encoding='utf-8', loads=json.loads, **kwargs):  # NOQA: E999
        return loads(self._body.decode(encoding))
5.
modlinltd/django-advanced-filters · q_serializer.py
Match rating: 65.21% · See similar code snippets
python logo
def loads(self, string, raw=False):
        if self.b64_enabled:
            d = json.loads(base64.b64decode(string))
        else:
            d = json.loads(string)
        if raw:
            return d
        return self.deserialize(d)
6.
openshift/openshift-restclient-python · client.py
Match rating: 63.93% · See similar code snippets
python logo
def load_json(response):
    if six.PY2:
        return json.loads(response.data)
    return json.loads(response.data.decode('utf8'))
7.
python/performance · bm_json_loads.py
Match rating: 63.88% · See similar code snippets
python logo
def bench_json_loads(objs):
    for obj in objs:
        # 20 loads
        json.loads(obj)
        json.loads(obj)
        json.loads(obj)
        json.loads(obj)
        json.loads(obj)
        json.loads(obj)
        json.loads(obj)
        json.loads(obj)
        json.loads(obj)
        json.loads(obj)
        json.loads(obj)
        json.loads(obj)
        json.loads(obj)
        json.loads(obj)
        json.loads(obj)
        json.loads(obj)
        json.loads(obj)
        json.loads(obj)
        json.loads(obj)
        json.loads(obj)
8.
aio-libs/aiohttp · http_websocket.py
Match rating: 63.87% · See similar code snippets
python logo
def json(self, *,  # type: ignore
             loads: Callable[[Any], Any]=json.loads) -> None:
        """Return parsed JSON data.

        .. versionadded:: 0.22
        """
        return loads(self.data)
9.
bunq/sdk_python · converter.py
Match rating: 63.81% · See similar code snippets
python logo
def json_to_class(cls, json_str):
    """
    :type cls: T|type
    :type json_str: str

    :rtype: T
    """

    obj_raw = json.loads(json_str)

    return deserialize(cls, obj_raw)
10.
475Cumulus/TBone · formatters.py
Match rating: 63.6% · See similar code snippets
python logo
def parse(self, body):
        if isinstance(body, bytes):
            return json.loads(body.decode('utf-8'))
        return json.loads(body)