Convert Dataframe to JSON
Hey! I have the following dataframe:

```python
                                    price
item_name            timestamp
item1                2018-10-12     12.2
                     2018-10-13     14.3
                     2018-10-14     17.1
item2                2018-10-12     11.4
                     2018-10-13     15.6
                     2018-10-14     17.2
item2                2018-10-12     11.5
                     2018-10-13     17.2
                     2018-10-14     17.2
```

And I want to convert it to JSON in the following format:
```json
{
   "item1":{
      "1539302400000": 12.2,
      "1539388800000": 14.3,
      "1539475200000": 17.1,
   },
   "item2":{
      "1539302400000":11.4,
      "1539388800000":15.6,
      "1539475200000":17.2,
   },
   "item3":{
      "1539302400000":11.5,
      "1539388800000":17.2,
      "1539475200000":17.2,
   }
}
```
However, I was not able to get json in the desired format.

`df.reset_index().to_json(orient='records')` gives me this:

```json
[
   {
      "item_name":"item1",
      "timestamp":1539302400000,
      "price":12.2
   },
   {
      "item_name":"item1",
      "timestamp":1539388800000,
      "price":14.3
   },
   {
      "item_name":"item1",
      "timestamp":1539475200000,
      "price":17.1
   },
   {
      "item_name":"item2",
      "timestamp":1539302400000,
      "price":11.4
   },
   {
      "item_name":"item2",
      "timestamp":1539388800000,
      "price":15.6
   },
   {
      "item_name":"item2",
      "timestamp":1539475200000,
      "price":17.2
   },
]
```

Can anyone give me a clue how to accomplish that?

<details>

INSTALLED VERSIONS
------------------
commit: None
python: 2.7.15.final.0
python-bits: 64
OS: Linux
OS-release: 4.18.0-16-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: None.None

pandas: 0.24.2
pytest: None
pip: 9.0.1
setuptools: 40.8.0
Cython: None
numpy: 1.15.1
scipy: None
pyarrow: None
xarray: None
IPython: None
sphinx: 1.7.6
patsy: None
dateutil: 2.7.3
pytz: 2018.5
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml.etree: None
bs4: None
html5lib: 0.999999999
sqlalchemy: None
pymysql: 0.9.2
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
gcsfs: None

</details>