I am dealing with 2 JSON arrays
"feeds":[
{
"created_at":"2021-11-28T00:11:38Z",
"entry_id":17901,
"field1":"16.40000",
"field2":"45.50000",
"field3":"16.06250",
"field4":"5.20000",
"field5":"49.79300",
"field7":"1",
"field8":"390267909"
}
]
and
"measurements":[
{
"user_id":1,
"measurements_id":1,
"fieldId":1,
"name":"Unutrašnja temperatura vazduha",
"unit":"°C",
"url":"inner-temp.png"
}]
In my current code, I retrieve the value of field1 using myField=feeds.field1
which gives me a value of 16.4000
. However, I now have a requirement to dynamically add these values based on the fieldId
property from the second JSON array measurements
.
Essentially, I need something like:
myField='feeds.field'+measurements.fieldId
and once again, myField
should be 16.4000
.