Return Value from JSON

Hello I am trying to get the temperature value from this JSON but it has been impossible.
Could you tell me why?

{“applicationID”:“1”,“applicationName”:“TrackingLora”,“deviceName”:“TrackerSolar”,“devEUI”:“AA115lZNwfM=”,“rxInfo”:[{“gatewayID”:“uCfr//5cYX0=”,“time”:“2022-08-10T12:10:40.295773Z”,“timeSinceGPSEpoch”:“1344168659.295s”,“rssi”:-61,“loRaSNR”:9.8,“channel”:7,“rfChain”:0,“board”:0,“antenna”:0,“location”:{“latitude”:14.47751,“longitude”:-17.04066,“altitude”:12,“source”:“UNKNOWN”,“accuracy”:0},“fineTimestampType”:“NONE”,“context”:“lb7CxA==”,“uplinkID”:“YozwUpbBQBmKRs4EuTbItQ==”,“crcStatus”:“CRC_OK”}],“txInfo”:{“frequency”:867900000,“modulation”:“LORA”,“loRaModulationInfo”:{“bandwidth”:125,“spreadingFactor”:7,“codeRate”:“4/5”,“polarizationInversion”:false}},“adr”:true,“dr”:5,“fCnt”:16,“fPort”:2,“data”:“AgIBRwNoXgRnAZgFcyeOBgICFA==”,“objectJSON”:“{"analogInput":{"2":3.27,"6":5.32},"temperatureSensor":{"4":40.8},"humiditySensor":{"3":47},"barometer":{"5":1012.6}}”,“tags”:{},“confirmedUplink”:false,“devAddr”:“AXGyBw==”,“publishedAt”:“2022-08-10T12:10:41.612117203Z”,“deviceProfileID”:“ed8de6e6-74f6-485e-b29b-ad7998aa592c”,“deviceProfileName”:“LP-TRACKER-OTAA”}

Here is what I did.

[
{
“type”: “jsonPath”,
“path”: “$.objectJSON.temperatureSensor.4”,
“returnFirst”: false,
“returnLast”: false
}
]

Just two remarks looking a the JSON:

  1. a validator I used didn’t like the quotation marks, they should be "
  2. There is a redundant " in ...==","objectJSON":"{"analogInput":{"2":3 just before the { and after its closing }.

So then it becomes:

{
  "applicationID": "1",
  "applicationName": "TrackingLora",
  "deviceName": "TrackerSolar",
  "devEUI": "AA115lZNwfM=",
  "rxInfo": [
    {
      "gatewayID": "uCfr//5cYX0=",
      "time": "2022-08-10T12:10:40.295773Z",
      "timeSinceGPSEpoch": "1344168659.295s",
      "rssi": -61,
      "loRaSNR": 9.8,
      "channel": 7,
      "rfChain": 0,
      "board": 0,
      "antenna": 0,
      "location": {
        "latitude": 14.47751,
        "longitude": -17.04066,
        "altitude": 12,
        "source": "UNKNOWN",
        "accuracy": 0
      },
      "fineTimestampType": "NONE",
      "context": "lb7CxA==",
      "uplinkID": "YozwUpbBQBmKRs4EuTbItQ==",
      "crcStatus": "CRC_OK"
    }
  ],
  "txInfo": {
    "frequency": 867900000,
    "modulation": "LORA",
    "loRaModulationInfo": {
      "bandwidth": 125,
      "spreadingFactor": 7,
      "codeRate": "4/5",
      "polarizationInversion": false
    }
  },
  "adr": true,
  "dr": 5,
  "fCnt": 16,
  "fPort": 2,
  "data": "AgIBRwNoXgRnAZgFcyeOBgICFA==",
  "objectJSON": {
    "analogInput": {
      "2": 3.27,
      "6": 5.32
    },
    "temperatureSensor": {
      "4": 40.8
    },
    "humiditySensor": {
      "3": 47
    },
    "barometer": {
      "5": 1012.6
    }
  },
  "tags": {},
  "confirmedUplink": false,
  "devAddr": "AXGyBw==",
  "publishedAt": "2022-08-10T12:10:41.612117203Z",
  "deviceProfileID": "ed8de6e6-74f6-485e-b29b-ad7998aa592c",
  "deviceProfileName": "LP-TRACKER-OTAA"
}

So maybe it has to do with how the data is sent. If it does not help, I can try the filter myself when I find some time.

Oh, and maybe set “returnFirst”: true,

I am not able to change the way the JSON is structured.
It is created automatically because it is an LPP.
Could you tell me if there is a way to do that?
Thank you.

I’m not familiar LPP. There is no way to influence how the data is sent?
In a quick test I find that the extra “” around the objectJSON object are an issue. Without those I can filter it successfully.

I really can’t … because it is a plug and play system where you put sensors and with LPP it can decode the info automatically but it is adding those extra ".
Is there a way to read it as a string first and parse it ?
Or maybe with regex.

I created this regular expression temperatureSensor\":{\“4\”:(.*)},\"humiditySensor but it is telling me that it failed to save the asset. I have tested the expression and it should be correct.

{
“type”: “regex”,
“pattern”: “temperatureSensor\\":{\\"4\\":(.*)},\\"humiditySensor”,
“matchGroup”: 1
}