I have found myself in an awkward situation with current (Python 3.7) JSON module. Basically it boils down to how it handles floats. I had been hit on this particular case: In [31]: float(0.6441726684570313) Out[31]: 0.6441726684570312 but I guess it really does not matter. What matters is that I did not find a way how to fix it with the standard `json` module. I have the JSON file generated by another program (C++ code, which uses nlohmann/json library), which serializes one of the floats to the value above. Then when reading this JSON file in my Python code, I can get either decimal.Decimal object (when specifying `parse_float=decimal.Decimal`) or float. If I use the latter the least significant digit is lost in deserialization. If I use Decimal, the value is preserved, but there seems to be no way to "serialize it back". Writing a custom serializer: class DecimalEncoder(json.JSONEncoder): def default(self, o): if isinstance(o, decimal.Decimal): return str(o) # <- This becomes quoted in the serialized output return super.default(o) seems to only allow returning "string" value, but then serializes it as a string! I.e. with the double quotes. What seems to be missing is an ability to return a "raw textual representation" of the serialized object which will not get mangled further by the `json` module. I noticed that `simplejson` provides an explicit option for its standard serializing function, called `use_decimal`, which basically solves my problem., but I would just like to use the standard module, I guess. So the question is, if something like `use_decimal` has been considered for the standard module, and if yes, why it was not implemented, or the other option could be to support "raw output" in the serializer, e.g. something like: class DecimalEncoder(json.JSONEncoder): def raw(self, o): if isinstance(o, decimal.Decimal): return str(o) # <- This is a raw representation of the object return super.raw(o) Where the returning values will be directly passed to the output stream without adding any additional characters. Then I could write my own Decimal serializer with few lines of code above. If anyone would want to know, why the last digit matters (or why I cannot double quote the floats), it is because the file has a secure hash attached and this basically breaks it.