I have a dataframe like this:
   date  ...   ID     value_1  value_2  value_3
0  03/03/2018    ...  12345    111       1      30
1  03/03/2018    ...  89547    222       2      50
2  02/03/2018    ...  12345    333       5      80
I want to convert it to JSON format like this:
{
    "XYZ": [
        {
            "Id": 123456,
            "date": "2021-03-03 09:00:00", # this field need to change datetime format
            "value_3": 30,
            "value_2": 1,
            "ABC": [
                {
                    "value_1": 111,
                    "type": "int" # 'type' field will always be 'int'
                }
            ]
        },
        {
            "Id": 123456,
            "date": "2021-03-02 09:00:00", # this field need to change datetime format
            "value_3": 80,
            "value_2": 5,
            "ABC": [
                {
                    "value_1": 333,
                    "type": "int" # 'type' field will always be 'int'
                }
            ]
        },
        {
            "Id": 89547,
            "date": "2021-03-03 09:00:00", # this field need to change datetime format
            "value_3": 50,
            "value_2": 2,
            "ABC": [
                {
                    "value_1": 222,
                    "type": "int" # 'type' field will always be 'int'
                }
            ]
        }
    ]
}
I'm not very familiar with data manipulation in Python, is there a simple way to do the conversion (built-in function or any libraries?)? Many thanks.
 
     
    