fix column_arrays for array manager
State: closed

- [x] closes #44994
- [ ] tests added / passed
   - None - makes tests for JSON on array manager work
- [x] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit) for how to run them
- [ ] whatsnew entry
    - Not needed - issue identified as result of another PR

Note - I was doing this in parallel with @phofl skipping the JSON tests for the array manager.  So I undid those changes so that the JSON code tests with array manager are done.

Labels:
name: IO JSON
description: read_json, to_json, json_normalize

Comments:
@jreback I think this is good to go - all failures are related to the `distutils` issue.
@Dr-Irv can you merge master
> @Dr-Irv can you merge master

Done.  One of the tests timed out - should I try again?
> > @Dr-Irv can you merge master
> 
> Done. One of the tests timed out - should I try again?

umm can you just use `np.asarray`?

> 
> umm can you just use `np.asarray`?

An `ExtensionArray` has the `to_numpy()` method, which also handles NA values correctly. The default implementation does use `np.asarray()`, but someone implementing an EA subclass has the option of overriding the implementation, so it seems we should use that instead.
ok can u see if we repeat this code elsewhere iirc o have seen this a few times and don't want to reinvent the wheel yet again
> ok can u see if we repeat this code elsewhere iirc o have seen this a few times and don't want to reinvent the wheel yet again

There is one place:

`pandas/core/arrays/_mixins.py` has class `NDArrayBackedExtensionArray` with method `_validate_searchsorted_value()` that is identical to `convert_array()` above.  But the classes  `NDArrayBackedExtensionArray` and `ArrayManager` are unrelated.

So a solution would be to move `convert_array()` to `pandas/core/common.py`, and change calls to `_validate_search_sorted()` to use that `convert_array()` instead.  Let me know if I should do that.
> > ok can u see if we repeat this code elsewhere iirc o have seen this a few times and don't want to reinvent the wheel yet again
> 
> There is one place:
> 
> `pandas/core/arrays/_mixins.py` has class `NDArrayBackedExtensionArray` with method `_validate_searchsorted_value()` that is identical to `convert_array()` above. But the classes `NDArrayBackedExtensionArray` and `ArrayManager` are unrelated.
> 
> So a solution would be to move `convert_array()` to `pandas/core/common.py`, and change calls to `_validate_search_sorted()` to use that `convert_array()` instead. Let me know if I should do that.

yep let's do it, though I think you can leave the convert_array function in `core/arrays/_mixins` (or similar) @jbrockmendel could suggest a good location
> yep let's do it, though I think you can leave the convert_array function in core/arrays/_mixins (or similar) @jbrockmendel could suggest a good location

I will await the suggested location from @jbrockmendel before making that change 


ExtensionBlock.values_for_json just uses `np.asarray(self.values)`, so i dont think the distinction with to_numpy makes a difference.  DatetimeTZBlock.values_for_json does something more performant which you could reuse.

Just use np.asarray and be done with it.
> Just use np.asarray and be done with it.

OK that is in commit https://github.com/pandas-dev/pandas/pull/45001/commits/178b2dda76bf668c4d3c494ad176c22eeb3e278a
@jbrockmendel @jreback this is now all green and just uses `np.asarray()`
thanks @Dr-Irv