Open
Description
Discovered by @ArtificialQualia in #31748
Previous behavior on 0.25.3:
>>> pd.Series([1], index=[np.nan]).to_json()
'{"null":1}'
>>> pd.Series([1], index=[pd.NaT]).to_json()
'{"null":1}'
>>> pd.Series([1], index=[None]).to_json()
'{"null":1}'
And now on master:
>>> pd.Series([1], index=[np.nan]).to_json()
'{"nan":1}'
>>> pd.Series([1], index=[pd.NaT]).to_json()
'{"null":1}'
>>> pd.Series([1], index=[None]).to_json()
'{"None":1}'
Note that pd.NA also just has its str representation written out:
>>> pd.Series([1], index=[pd.NA]).to_json()
'{"<NA>":1}'
pd.NaT still works because of this logic:
pandas/pandas/_libs/src/ujson/python/objToJSON.c
Line 1455 in 6d3cc14
So probably need to generalize for other "null" values