Extracting json before using Item Lists

Hello,

I’m trying to extract part of this json to then use Item Lists node.

I make the assumption there is no user possibility than to use a function node, but I can’t find the right one.

Here is the json:

[
  {
    "systems": [
      {
        "data": [
          {
            "systemID": 1,
            "zoneID": 1,
            "name": "Bureau GR",
            "on": 0,
            "maxTemp": 30,
            "minTemp": 18,
            "setpoint": 25.5,
            "roomTemp": 21.600000381469727,
            "modes": [
              1,
              4,
              2,
              3,
              5
            ],
            "mode": 2,
            "coldStages": 1,
            "coldStage": 1,
            "heatStages": 1,
            "heatStage": 1,
            "humidity": 46,
            "units": 0,
            "errors": [],
            "air_demand": 0,
            "floor_demand": 0
          },
          {
            "systemID": 1,
            "zoneID": 2,
            "name": "Ch. Parents",
            "on": 0,
            "maxTemp": 30,
            "minTemp": 18,
            "setpoint": 25,
            "roomTemp": 21.299999237060547,
            "mode": 2,
            "coldStages": 1,
            "coldStage": 1,
            "heatStages": 1,
            "heatStage": 1,
            "humidity": 58,
            "units": 0,
            "errors": [],
            "air_demand": 0,
            "floor_demand": 0
          },
          {
            "systemID": 1,
            "zoneID": 3,
            "name": "Cuisine",
            "on": 0,
            "maxTemp": 30,
            "minTemp": 18,
            "setpoint": 25,
            "roomTemp": 21,
            "mode": 2,
            "coldStages": 1,
            "coldStage": 1,
            "heatStages": 1,
            "heatStage": 1,
            "humidity": 57,
            "units": 0,
            "errors": [],
            "air_demand": 0,
            "floor_demand": 0
          }
        ]
      },
      {
        "data": [
          {
            "systemID": 2,
            "zoneID": 1,
            "name": "Ch. enfants",
            "on": 0,
            "maxTemp": 30,
            "minTemp": 18,
            "setpoint": 26,
            "roomTemp": 20.899999618530273,
            "mode": 2,
            "coldStages": 1,
            "coldStage": 1,
            "heatStages": 1,
            "heatStage": 1,
            "humidity": 52,
            "units": 0,
            "errors": [],
            "air_demand": 0,
            "floor_demand": 0
          },
          {
            "systemID": 2,
            "zoneID": 2,
            "name": "Bureau TR",
            "on": 0,
            "maxTemp": 30,
            "minTemp": 18,
            "setpoint": 26,
            "roomTemp": 20.700000762939453,
            "modes": [
              1,
              4,
              2,
              3,
              5
            ],
            "mode": 2,
            "coldStages": 1,
            "coldStage": 1,
            "heatStages": 1,
            "heatStage": 1,
            "humidity": 47,
            "units": 0,
            "errors": [],
            "air_demand": 0,
            "floor_demand": 0
          },
          {
            "systemID": 2,
            "zoneID": 3,
            "name": "Ch. Guerric",
            "on": 0,
            "maxTemp": 30,
            "minTemp": 18,
            "setpoint": 23,
            "roomTemp": 20.399999618530273,
            "mode": 2,
            "coldStages": 1,
            "coldStage": 1,
            "heatStages": 1,
            "heatStage": 1,
            "humidity": 51,
            "units": 0,
            "errors": [],
            "air_demand": 0,
            "floor_demand": 0
          },
          {
            "systemID": 2,
            "zoneID": 4,
            "name": "Ch. Nolwenn",
            "on": 0,
            "maxTemp": 30,
            "minTemp": 18,
            "setpoint": 26,
            "roomTemp": 20.600000381469727,
            "mode": 2,
            "coldStages": 1,
            "coldStage": 1,
            "heatStages": 1,
            "heatStage": 1,
            "humidity": 49,
            "units": 0,
            "errors": [],
            "air_demand": 0,
            "floor_demand": 0
          }
        ]
      }
    ]
  }
]

At the end , my goal is to have a table with name / roomTemp / humidity.

Thanks a lot for your help

Hi,

Seems to me like you can simply put “systems.data” as the field in the item lists node.

Does not work, I get:

ERROR: Couldn’t find the field ‘systems.data’ in the input data

But it helps me to find a way of doing it. If i first add a set with that expression:
{{ $json["systems"][0]["data"] }}

Then I can use Item Lists.

Maybe Items Lists only work on first level ?

oh sorry, didnt see that systems was also an array.
So that is the issue here indeed. might be able to do systems[0].data
but I have never tried that.

to be clear, the problem is not that it cannot only do the first level, but is that the first level is an array. So it cannot go into an array and then into another array. As it does not know in what item of the first array it should look.

1 Like

Exact, it works perfectly with systems[0].data. On step less in the workflow ! Thanks @BramKn

1 Like

Awesome good to know we can do this. :slight_smile:

Hi,

I have lost that workflow and I’m trying to make it work again.

But I can’t find anymore how I did as Set and Item Lists nodes have evolved in recent version.

Any suggestion to manipulate specifically items listed in json at systemID leve ?

I answer myself, the API is sending \n in the response, which mess up the items list node.

1 Like