New submission from Mitar <mmi...@gmail.com>:
Currently, there is only one argument which allows customization how float numbers are encoded in JSON: allow_nan. But this does not allow one to hook into the encoding of floating points really. The JSONEncoder is not called for float numbers. The motivation here is that we would like to encode NaN and Infinity values differently, instead of non-standard approach and instead of raising an exception. The "load" counterpart has "parse_float" which one can use to hook into parsing floats. I would suggest something similar, maybe "encode_float" which if provided would be used instead of the default. ---------- components: Library (Lib) messages: 341817 nosy: mitar priority: normal severity: normal status: open title: Supporting customization of float encoding in JSON _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36841> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com