Beispiel #1
0
def loads(s, **kwargs):
    """Unserialize a JSON object from a string ``s`` by using the application's
    configured decoder (:attr:`~flask.Flask.json_decoder`) if there is an
    application on the stack.
    """
    _load_arg_defaults(kwargs)
    return _json.loads(s, **kwargs)
Beispiel #2
0
def loads(s, **kwargs):
    """Unserialize a JSON object from a string ``s`` by using the application's
    configured decoder (:attr:`~flask.Flask.json_decoder`) if there is an
    application on the stack.
    """
    _load_arg_defaults(kwargs)
    return _json.loads(s, **kwargs)
Beispiel #3
0
def loads(s, **kwargs):
    """Unserialize a JSON object from a string ``s`` by using the application's
    configured decoder (:attr:`~flask.Flask.json_decoder`) if there is an
    application on the stack.
    """
    if current_app:
        kwargs.setdefault('cls', current_app.json_decoder)
    return _json.loads(s, **kwargs)
Beispiel #4
0
def loads(s, **kwargs):
    """Unserialize a JSON object from a string ``s`` by using the application's
    configured decoder (:attr:`~flask.Flask.json_decoder`) if there is an
    application on the stack.
    """
    if current_app:
        kwargs.setdefault('cls', current_app.json_decoder)
    return _json.loads(s, **kwargs)
Beispiel #5
0
def loads(s, **kwargs):
    """Unserialize a JSON object from a string ``s`` by using the application's
    configured decoder (:attr:`~flask.Flask.json_decoder`) if there is an
    application on the stack.
    """
    _load_arg_defaults(kwargs)
    if isinstance(s, bytes):
        s = s.decode(kwargs.pop('encoding', None) or 'utf-8')
    return _json.loads(s, **kwargs)
Beispiel #6
0
    def _obj_from_json(self, filename):
        try:
            with open(filename) as json_file:
                obj = _json.loads(json_file.read())

        except Exception as e:
            log.critical('Unable to load configuration file (%s)' % e.message)
            exit(1)
        return obj
Beispiel #7
0
    def _obj_from_json(self, filename):
        try:
            with open(filename) as json_file:
                obj = _json.loads(json_file.read())

        except Exception as e:
            log.critical('Unable to load configuration file (%s)' % e.message)
            exit(1)
        return obj
Beispiel #8
0
def loads(s, **kwargs):
    _load_arg_defaults(kwargs)
    if isinstance(s, bytes):
        s = s.decode(kwargs.pop('encoding', None) or 'utf-8')
    return _json.loads(s, **kwargs)