What is proper CS JSON uplink format for storing parameters in MySQL database with http POST?

Hi,

I have the following PHP code for storing data from the JSON file sent with http POST from ChirpStack to a receiving PHP script on an external server. Here the first lines with which I want to extract the desired data from the uplinked JSON file:

<?php require 'config.php'; $ttn_post = file('php://input'); $data = json_decode($ttn_post[0]); $sensor_raw_payload = $data->data; $ttn_app_id = $data->object->app_id; $sensor_batt = $data->object->batt; $ttn_dev_id = $data->object->dev_id; $sensor_latitude = $data->object->lat; $sensor_longitude = $data->object->lng; $sensor_acc = $data->object->acc; $sensor_gps = $data->object->gps; $ttn_time = $data->object->time_stamp; $gtw_id = $data->rxInfo->0->gatewayId; $gtw_rssi = $data->rxInfo->0->rssi; $gtw_snr = $data->rxInfo->0->snr; $db_connect = mysqli_connect(DATABASE_HOST, DATABASE_USERNAME, DATABASE_PASSWORD, DATABASE_NAME) or die(mysql_error()); The corresponding uplink JSON files shows the following: { "deduplicationId": "976e807e-6cba-4e36-8f1d-888bcfbca180", "time": "2024-12-28T17:54:35.871232686+00:00", "deviceInfo": { "tenantId": "52f14cd4-c6f1-4fbd-8f87-4025e1d49242", "tenantName": "ChirpStack", "applicationId": "2bf895f9-83ce-4c44-8066-f86f66c2e5ad", "applicationName": "otter", "deviceProfileId": "a753b0d6-5dca-4bd2-b248-53f6dcc096e8", "deviceProfileName": "ottXX", "deviceName": "track-it-wit", "devEui": "ac1f09fffe047517", "deviceClassEnabled": "CLASS_A", "tags": {} }, "devAddr": "0028XXX", "adr": false, "dr": 1, "fCnt": 12, "fPort": 2, "confirmed": false, "data": "ywoAAACuAAAAxQBYcAEDK9FCFwdXXXXXXXX=", "object": { "app_id": 174, "gps_start": 7, "dev_id": 197, "fix": 1, "date_stamp": "28.12.2024", "num": 10, "stat": 1, "acc": 23, "time_stamp": "18:54", "time": 1735408476, "lng": "YY.795841", "batt": 85, "gps": 8, "lat": "XX.203266", "location": "(XX.203266,YY.795841)" }, "rxInfo": [ { "gatewayId": "b827ebfffeXXXX", "uplinkId": 3295943103, "nsTime": "2024-12-28T17:54:35.590322007+00:00", "rssi": -99, "snr": 8.5, I have put some XXX's and YYY's for privacy reasons. I have used the same kind of PHP code for getting those parameters from the TTN stack JSON uplink and that works well. After adaptation to the ChirpStack JSON format I do not get it to work. Perhaps I am missing something in such a line: $sensor_batt = $data->object->batt; Maybe it should be extended somehow with an extra path: $sensor_batt = $data->XXX->object->batt; If so what is the XXX or what should be done differently? Thanks for your help! Best wishes, Addy