# Harmonizing the JSON serialization of non-finite float values with browsers and other languages

**URL:** <https://discuss.python.org/t/harmonizing-the-json-serialization-of-non-finite-float-values-with-browsers-and-other-languages/20477>\
**Category:** Ideas\
**Created:** [October 28, 2022, 9:28am UTC](https://discuss.python.org/t/harmonizing-the-json-serialization-of-non-finite-float-values-with-browsers-and-other-languages/20477 "2022-10-28T09:28:30Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![encukou](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/encukou/32/2461_2.png) [@encukou](https://discuss.python.org/u/encukou)\
**Post date:** [January 11, 2023, 9:57am UTC](https://discuss.python.org/t/harmonizing-the-json-serialization-of-non-finite-float-values-with-browsers-and-other-languages/20477/4 "2023-01-11T09:57:31Z")

</div>

I wouldn’t be surprised if _someone_ out there was using `allow_nan=None` to mean `allow_nan=False`. We shouldn’t change the meaning silently.  
Solutions I can think of:

- Adding a new argument, like `nonfinite=None`. Initially it would _only_ take `None` but it could be extended in the future, if necessary.

- Using a specific value that’s very unlikely to be used currently, like `allow_nan='null'`. To allow future extensions, start emitting a `DeprecationWarning` when a non-`bool` is passed to `allow_nan`.

---

_[View the full topic](https://discuss.python.org/t/harmonizing-the-json-serialization-of-non-finite-float-values-with-browsers-and-other-languages/20477)._
