
But my proposal is not more complex. Implementing support for Decimal requires exactly the same steps as implementing the support for custom type. 1) One has to recognize the type in the input data, 2) Get the JSON representation, possibly by using obj.__str__(). 3) Check the output that it conforms JSON real number spec. The only difference is that in one case you need a kw to specify the custom type, in the other, you need a Boolean kw to explicitly pull in decimal.Decimal (to avoid unconditional import of decimal). Then, the decoder already allows custom type, in parse_float, so having the same option on the output seems to me better. I admit, I consider my proposal to be as complex as yours, and better fitting, to what is already implemented in decoder.