Arduino JSON foreach loop
I found another way around the solution. 

Idk if this is helpful to anyone but the problem was that I had an unknown number of nodes I wanted to loop through, Example of the json format above.

void loop(){
int httpCode = http.GET();
  if(httpCode &gt; 0) {
    // if Get request has processed
    if(httpCode == HTTP_CODE_OK) {
          payload = http.getString();
      }
      if(payload.length() &gt; 0){
          JsonArray&amp; nodes = jsonBuffer.parseArray(payload);
          if (!nodes.success()) {
            Serial.println("parseObject() failed");
            jsonBuffer.clear();
          }else{
            int node_length = nodes.size(); 
            for(int i=0; i&lt;node_length;i++){
              Serial.printf("node-%i\nValue : ",i );
              String value = nodes[i]["value"].as&lt;const char*&gt;();
              String state = nodes[i]["state"].as&lt;const char*&gt;();
              Serial.println(value);
              Serial.print("State : ");
              Serial.println(state); 
            }
            http.end();
        }
    }else{
      Serial.println("Payload Empty");
    }
  }

  jsonBuffer.clear();
  delay(8000);
}