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 with_json_data(dct): return dict(data=encode_json(dct), content_type='application/json')
def make_response(self, data, status_code): json_data = encode_json(data) response = make_response(json_data) response.status_code = status_code response.mimetype = 'application/json' return response
def _serialize(self, data): return encode_json(self.output_filter.filter(data))
def process_bind_param(self, value, dialect): if value is not None: value = encode_json(self.serializer.serialize(value)) return value