miLibris / flask-rest-jsonapi

Flask extension to build REST APIs around JSONAPI 1.0 specification.
http://flask-rest-jsonapi.readthedocs.io
MIT License
598 stars 153 forks source link

Added support for Decimal type in JSON encoder #169

Closed dxmo closed 3 years ago

dxmo commented 5 years ago

Added handling of Decimal type to JSON Encoder (since the switch to 'json.dumps' Decimal type was no longer supported).

coveralls commented 5 years ago

Coverage Status

Coverage decreased (-0.1%) to 90.635% when pulling 32fa5e88d511c978840418269eee94734f9879d8 on dxmo:add_decimal_support into b44bc08b11213d49fadae873650d3555889052ec on miLibris:master.

dxmo commented 5 years ago

Hi, my API needs to handle Decimal type so I've created this simple fix. It would probably be better to use 'simplejson' (with a fallback to 'json') like flask (specifically the itsdangerous json module) is doing, but this works for me.