def test_json(): s = '[0, true, "False"]' compare(s, encode_json([0, True, 'False'])) compare(s, encode_json(decode_json(s))) d = {'one': 0, 'two': True, 'three': 'False'} s = '{"three": "False", "two": true, "one": 0}' compare(s, encode_json(d)) compare(d, decode_json(encode_json(d)))
def before(self): input = None if request.content_length: if request.mimetype == 'application/json': try: input = self.filter.filter(decode_json(request.data)) except: raise InvalidJSONException(request.data) else: raise InvalidMimetypeException(request.mimetype) g.ctx.input = input
def json(self): return decode_json(self.data)
def _deserialize(self, data): return self.input_filter.filter(decode_json(data))
def process_result_value(self, value, dialect): if value is not None: value = self.model_class(**decode_json(value)) return value