snjypl commented on issue #28103:
URL: https://github.com/apache/airflow/issues/28103#issuecomment-1337515462

   @potiuk  i was wondering if this could be a solution: 
https://github.com/open-contracting/spoonbill-web/commit/6987a7e0b820c35cd8a9e9d62befdf7200de7348
   
   `json.dumps(item,default=str)`
   ```
   >>> from decimal import Decimal
   >>> import json
   >>> item = {'a':1, 'b':Decimal(1038)}
   >>> json.dumps(item)
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "/usr/lib/python3.8/json/__init__.py", line 231, in dumps
       return _default_encoder.encode(obj)
     File "/usr/lib/python3.8/json/encoder.py", line 199, in encode
       chunks = self.iterencode(o, _one_shot=True)
     File "/usr/lib/python3.8/json/encoder.py", line 257, in iterencode
       return _iterencode(o, 0)
     File "/usr/lib/python3.8/json/encoder.py", line 179, in default
       raise TypeError(f'Object of type {o.__class__.__name__} '
   TypeError: Object of type Decimal is not JSON serializable
   >>> json.dumps(item,default=str)
   '{"a": 1, "b": "1038"}'
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to