BUG: to_json failing on PyPy
- [x] closes #39837
- [x] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#code-standards) for how to run them
- [x] whatsnew entry

Not sure how best to test this - confirmed this now works when run on PyPy, but since we don't test against PyPy the examples in the issue (or any other simple case) which fail on PyPy will still pass on master. 

Benchmarks look similar, might be minor performance improvement for the single block case:

```
before           after         ratio
     [b524462e]       [b1f4bcc8]
     <master>         <bug/is_mixed_type>
          194±5ms          190±2ms     0.98  io.json.ToJSONISO.time_iso_format('columns')
          208±5ms          198±6ms     0.95  io.json.ToJSONISO.time_iso_format('index')
          186±4ms          173±3ms     0.93  io.json.ToJSONISO.time_iso_format('records')
         193±10ms          187±3ms     0.97  io.json.ToJSONISO.time_iso_format('split')
          164±4ms          165±3ms     1.00  io.json.ToJSONISO.time_iso_format('values')
          115±4ms          114±3ms     0.99  io.json.ToJSONLines.time_delta_int_tstamp_lines
          142±4ms          132±6ms     0.93  io.json.ToJSONLines.time_float_int_lines
          140±4ms          142±4ms     1.02  io.json.ToJSONLines.time_float_int_str_lines
          152±2ms          153±3ms     1.01  io.json.ToJSONLines.time_float_longint_str_lines
          110±3ms          107±3ms     0.97  io.json.ToJSONLines.time_floats_with_dt_index_lines
          112±3ms          104±3ms     0.93  io.json.ToJSONLines.time_floats_with_int_idex_lines
          54.3M            55M         1.01  io.json.ToJSONMem.peakmem_float
          55.4M               55.2M    1.00  io.json.ToJSONMem.peakmem_int
          88.6±2ms         78.8±2ms    0.89  io.json.ToJSON.time_to_json('index', 'df')
          70.7±2ms         61.7±2ms    0.87  io.json.ToJSON.time_to_json('values', 'df')
          94.9±3ms         81.4±1ms    0.86  io.json.ToJSON.time_to_json('index', 'df_date_idx')
          76.3±0.9ms       65.1±1ms    0.85  io.json.ToJSON.time_to_json('records', 'df_date_idx')
```