Describe the problem/error/question
Hello there,
I get data from a json where there are tons of information.
Right now I just get the data I need using the position of the information needed.
Like this:
{{$node["Consulta API Victron"].json["records"][167]["rawValue"]}}
That works well … until the position change and is not 167 anymore and the node fails.
What would be the way to get a value from the json by a key other than the position.
The json is like this:
[
{
"success": true,
"records": [
{
"idSite": 111111,
"timestamp": 1701917871,
"Device": "Gateway",
"instance": 0,
"idDataAttribute": 1,
"description": "gatewayID",
"formatWithUnit": "%s",
"dbusServiceType": null,
"dbusPath": null,
"code": "d",
"bitmask": 0,
"formattedValue": "Venus OS",
"rawValue": 2,
"dataAttributeEnumValues": [
{
"nameEnum": "VGR, VGR2 or VER",
"valueEnum": 0
},
{
"nameEnum": "Venus OS",
"valueEnum": 1
},
{
"nameEnum": "Venus OS",
"valueEnum": 2
},
{
"nameEnum": "Coupling / GlobalLink",
"valueEnum": 3
},
{
"nameEnum": "PHYSEE NodeMCU",
"valueEnum": 4
}
],
"id": 1
},
{
"idSite": 111111,
"timestamp": 1701917871,
"Device": "Gateway",
"instance": 0,
"idDataAttribute": 386,
"description": "Productid",
"formatWithUnit": "%s",
"dbusServiceType": null,
"dbusPath": null,
"code": "mi",
"bitmask": 0,
"formattedValue": "C002",
"rawValue": "C002",
"id": 2
},
{
"idSite": 111111,
"timestamp": 1701917871,
"Device": "Gateway",
"instance": 0,
"idDataAttribute": 387,
"description": "MachineName",
"formatWithUnit": "%s",
"dbusServiceType": null,
"dbusPath": null,
"code": "mn",
"bitmask": 0,
"formattedValue": "Venus GX",
"rawValue": "Venus GX",
"id": 3
},
I would like to get the value (for example) of "description": "gatewayID",
What is the error message (if any)?
Please share your workflow
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
Share the output returned by the last node
Information on your n8n setup
- n8n version: 0.189.1
- Database: SQLite
- n8n EXECUTIONS_PROCESS setting: default
- Running n8n via npm
- Operating system: Linux