API/BUG: Make `to_json` `index=` arg consistent with `orient` arg
Updates `to_json` with less surprising behavior with the `index` arg:
- split and table allow index=True/False (as before)
- records and values only allow index=False
- index and columns only allow index=True
- raise for contradictions in the latter two and update messages
- add test



- [x] closes #25513, closes #37600
- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [x] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [x] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.

Hey @WillAyd, this is a PR for your request [here](https://github.com/pandas-dev/pandas/issues/37600#issuecomment-1343553941). Let me know who I can tag for review. Consolidated the checks up front, hopefully this is clearer This pull request is stale because it has been open for thirty days with no activity. Please [update](https://pandas.pydata.org/pandas-docs/stable/development/contributing.html#updating-your-pull-request) and respond to this comment if you're still interested in working on this. Waiting on review, friendly ping @WillAyd  Looks good. Can you add the 2.1 whatsnew note? Took a stab at it, lmk if the whatsnew note looks good (never done one before) ```
 sort whatsnew entries alphabetically....................................................................Failed
- hook id: sort-whatsnew-items
- duration: 0.05s
- exit code: 1
- files were modified by this hook
pre-commit hook(s) made changes.
If you are seeing this message in CI, reproduce locally with: `pre-commit run --all-files`.
To run `pre-commit` as part of git workflow, use `pre-commit install`.
All changes made by hooks:
diff --git a/doc/source/whatsnew/v2.1.0.rst b/doc/source/whatsnew/v2.1.0.rst
index 56b7327..e0f417e 100644
--- a/doc/source/whatsnew/v2.1.0.rst
+++ b/doc/source/whatsnew/v2.1.0.rst
@@ -96,9 +96,9 @@ Other enhancements
 - Let :meth:`DataFrame.to_feather` accept a non-default :class:`Index` and non-string column names (:issue:`51787`)
 - Performance improvement in :func:`read_csv` (:issue:`52632`) with ``engine="c"``
 - :meth:`Categorical.from_codes` has gotten a ``validate`` parameter (:issue:`50975`)
+- Improved error messaging when using :meth:`DataFrame.to_json` with incompatible ``index`` and ``orient`` arguments (:issue:`52143`)
 - Performance improvement in :func:`concat` with homogeneous ``np.float64`` or ``np.float32`` dtypes (:issue:`52685`)
 - Performance improvement in :meth:`DataFrame.filter` when ``items`` is given (:issue:`52941`)
-- Improved error messaging when using :meth:`DataFrame.to_json` with incompatible ``index`` and ``orient`` arguments (:issue:`52143`)
``` @mroeschke sorted! Great! Thanks @dshemetov  Hey all, for what it's worth I think I'm running into a segfault in release `2.0.3` that was fixed by this PR.  Here is my bug report.  If it wasn't this PR, it was something that was fixed between `2.0.3` and `2.1.0`

https://github.com/pandas-dev/pandas/issues/58160
 This PR only disallowed certain combinations of arguments to `to_json()`, so I don't think it's the cause of the segfault in your report. I don't have any ideas that can help you off the top of my head, but I'll let you know if I do. Best of luck!