I am having some trouble with creating transactions using python-bitcoinrpc (on python 2.7.x).
It seems that the library doesn't support the Decimal data type; when I do:
It raises:
File "/usr/lib/python2.7/json/encoder.py", line 184, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: Decimal('0.001') is not JSON serializable
I have seen some solutions (http://stackoverflow.com/questions/1960516/python-json-serialize-a-decimal-object?)
but they all seem to entail converting the decimal either to float or to string. The first is not an option due to the loss of precision and the second creates a json-rpc error.
How can I ensure the decimal is properly encoded to json?
Thanks,
Tomas