diff --git a/.gitignore b/.gitignore index be648b3..37d3c2d 100644 --- a/.gitignore +++ b/.gitignore @@ -72,3 +72,6 @@ target/ pyvenv.cfg pip-selfcheck.json +# PyCharm +.idea + diff --git a/requirements.txt b/requirements.txt index 7ac68c2..907786b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,3 +9,4 @@ passlib==1.6.5 pathtools==0.1.2 SQLAlchemy-Utils==0.30.16 pytest==2.7.3 +simplejson==3.8.2 diff --git a/sqlalchemy_jsonapi/flaskext.py b/sqlalchemy_jsonapi/flaskext.py index 2548d32..d1ef1b5 100644 --- a/sqlalchemy_jsonapi/flaskext.py +++ b/sqlalchemy_jsonapi/flaskext.py @@ -6,7 +6,7 @@ """ import datetime -import json +import simplejson as json import uuid from functools import wraps @@ -35,6 +35,7 @@ def default(self, value): return str(value) return json.JSONEncoder.default(self, value) + #: The views to generate views = [ (Method.GET, Endpoint.COLLECTION), (Method.GET, Endpoint.RESOURCE), @@ -235,7 +236,7 @@ def new_view(**kwargs): response = override(exc, results) rendered_response = make_response('') if response.status_code != 204: - data = json.dumps(response.data, cls=self.json_encoder) + data = json.dumps(response.data, cls=self.json_encoder, use_decimal=True) rendered_response = make_response(data) rendered_response.status_code = response.status_code rendered_response.content_type = 'application/vnd.api+json'