export python pandas dataframe as json file

df.to_json(r'C:\Users\Ron\Desktop\File Name.json', orient='index')

#if you want to just convert to a json file, then omit the file path and enter only file name.

Here is what the above code is Doing:
1. We are using the to_json method on our dataframe.
2. We are specifying the file path where we want to save the file.
3. We are specifying the orientation as index. This means that the index of the dataframe will be used as the keys of the JSON file.
4. We are not specifying any other parameters.