Get data sleep duration from goole fite with Fitness API

`How do I calculate the duration of sleep I get from Google Fit.

this is an example of json from google fit the code

"session": [
    {
        "id": "healthkit-0B3E9A38-694F-4B88-B15B-9C534759131D",
        "name": "Tidur",
        "description": "",
        "startTimeMillis": "1713798000000",
        "endTimeMillis": "1713817920000",
        "modifiedTimeMillis": "1713826670476",
        "application": {
            "packageName": "com.xiaomi.miwatch.pro",
            "version": "",
            "detailsUrl": ""
        },
        "activityType": 72
    },
    {
        "id": "healthkit-ABA36AB8-09E5-4AEC-9A6B-AA9DC5547567",
        "name": "Tidur",
        "description": "",
        "startTimeMillis": "1713798000000",
        "endTimeMillis": "1713817920000",
        "modifiedTimeMillis": "1713826670476",
        "application": {
            "packageName": "com.xiaomi.miwatch.pro",
            "version": "",
            "detailsUrl": ""
        },
        "activityType": 72
    },
    {
        "id": "healthkit-E5E08251-357B-4620-B0AB-6EDC0321F8BB",
        "name": "Tidur",
        "description": "",
        "startTimeMillis": "1713798000000",
        "endTimeMillis": "1713817920000",
        "modifiedTimeMillis": "1713826670476",
        "application": {
            "packageName": "com.xiaomi.miwatch.pro",
            "version": "",
            "detailsUrl": ""
        },
        "activityType": 72
    }
],
"deletedSession": []