     Serial.println(counter);
 #endif
   }
-}
+} // loop
 
 void getWeatherData() //client function to send/receive GET request data.
 {


  if (counter >= GETDATACOUNT) //Get new data
  {
    // If we lost WiFi connection (it sometimes happens), restart the nodeMCU
    if (WiFi.status() != WL_CONNECTED) {
      ESP.restart();
    }
    else {
      counter = 0;
      getWeatherData();
    }
  }
  else {
    counter++;

    char c = client.read(); // Gets byte from WIFI buffer
    result = result + c;
  }
  client.stop(); //stop client

#ifdef DEBUG
  Serial.println(result);
#endif
  result.replace('[', ' ');
  result.replace(']', ' ');

// See the following for a description on JSON decoding:
// https://www.arduino.cc/en/Tutorial.WiFi101WeatherAudioNotifier
  char jsonArray [result.length() + 1];
  result.toCharArray(jsonArray, sizeof(jsonArray));
  jsonArray[result.length() + 1] = '\0';
