I want to export a Python dictionary to a JSON file via json.dumps()
.
The data is collected using a Django modelfield "DecimalField" which is using the python decimal datatype.
The problem now is, that the data inside the dictionary is presented like:
'interval': Decimal('2')
and the json.dumps() cannot handle this because of this Decimal string.
Is there any possibility to remove the "Decimal" from the output and just display the number like 'interval': 2
? Or do I need to change all my ModelFields to Float/Integer?