BUG: Index lost when serializing to json
- [X] I have checked that this issue has not already been reported.

- [X] I have confirmed this bug exists on the latest version of pandas.

- [ ] (optional) I have confirmed this bug exists on the master branch of pandas.

---

When serializing a pandas `DataFrame` to json the index is usally serialized by use of the `primary_key` in the json. In some cases this does not work. For example:

```python
import pandas as pd

df = pd.DataFrame({'ind': ['TIME', 'TIME'], 'id': [1, 1], 'data': [0.1, 0.2]})
df.set_index(['ind', 'id'], inplace=True)

js = df.to_json(orient='table')
new = pd.read_json(js, orient='table')
```

The json string `js`:

```
{"schema":{"fields":[{"name":"ind","type":"string"},{"name":"id","type":"integer"},{"name":"data","type":"number"}],"pandas_version":"0.20.0"},"data":[{"ind":"TIME","id":1,"data":0.1},{"ind":"TIME","id":1,"data":0.2}]}
```

The `new` data frame created by reading the json doesn't have the same index.


#### Output of ``pd.show_versions()``

<details>

INSTALLED VERSIONS
------------------
commit           : 2cb96529396d93b46abab7bbc73a208e708c642e
python           : 3.8.5.final.0
python-bits      : 64
OS               : Linux
OS-release       : 5.4.0-74-generic
Version          : #83-Ubuntu SMP Sat May 8 02:35:39 UTC 2021
machine          : x86_64
processor        : x86_64
byteorder        : little
LC_ALL           : None
LANG             : en_US.UTF-8
LOCALE           : en_US.UTF-8

pandas           : 1.2.4
numpy            : 1.20.2
pytz             : 2019.3
dateutil         : 2.7.3
pip              : 21.1.1
setuptools       : 45.2.0
Cython           : None
pytest           : 6.2.4
hypothesis       : None
sphinx           : 3.5.4
blosc            : None
feather          : None
xlsxwriter       : None
lxml.etree       : None
html5lib         : None
pymysql          : None
psycopg2         : None
jinja2           : 2.11.3
IPython          : 7.13.0
pandas_datareader: None
bs4              : None
bottleneck       : None
fsspec           : 2021.04.0
fastparquet      : None
gcsfs            : None
matplotlib       : 3.4.2
numexpr          : None
odfpy            : None
openpyxl         : None
pandas_gbq       : None
pyarrow          : None
pyxlsb           : None
s3fs             : None
scipy            : 1.6.3
sqlalchemy       : None
tables           : None
tabulate         : None
xarray           : None
xlrd             : None
xlwt             : None
numba            : None


</details>
