title: How to store JSON Array in arduino program?
body: <p>I was working on IOT project for which I needed JSON parsing in NodeMCU.
  I saw this sample code for arduino for parsing JSON with the help of ArduinoJson library which worked well and I was able to get and parse the data from url(say url_1) successfully. Now I want to store this data in an array so that when I get data from the other ur2(say url_2) I can compare them with each other and trigger an event repective to the result.
  Data in url_1 and url_2 is of form,<br>
  ["1","1","1","1","0","0","0","0"]<br>
  and assume that url_1 had same values as specified.</p>
  
  <p>What I did was I declared an array Data[] in which I stored the parsed JSON values so that I could use them later on in if else statements in the code.
  As you can see that the data I am retrieving in url have 1's and 0's only, so what I want to do is that "If get 1 do this", "else do that", which you can see in the code. But the problem is that once I end the connection to the url the Data[] array gives only garbage values which I checked by printing them on serial monitor as shown in the code.<br>
  What I believe is that "const char* Data[20];" stores the position of JSON data and when I end the connection, the data at those position is also lost that's why I'm getting the garbage values. Now, I could be wrong since I'm new to this stuff. That's why I wanted to know how to solve this problem which is that if what I said was right, then how could I store the parsed json data in an array so that it is not lost even if the connection to the url has been ended.<br>
  (I'm new to this platform so If I did something wrong and wish that you guys can guide me for the future and I also apologize for my broken english).</p>
  
  <pre><code>#include &lt;ESP8266WiFi.h&gt;
  #include &lt;ESP8266HTTPClient.h&gt;
  #include &lt;ArduinoJson.h&gt;  
  
  const char* Data[20];
  const char* ssid = "SSID";
  const char* password = "Password";
  
  //Connecting to WiFi
  void setup() {
    WiFi.mode(WIFI_OFF);
    delay(1000);
    WiFi.mode(WIFI_STA);// Hides the viewing of ESP as wifi Hotspot 
    WiFi.begin(ssid, password);
  
    while (WiFi.status() != WL_CONNECTED) {
      delay(1000);
      Serial.println("Connecting...");
    }
    Serial.println("Connected to WiFi Successfully");
  }
  
  void loop()
  {
    if(WiFi.status()== WL_CONNECTED)
    {
      HTTPClient http;
      //Starting connection  to url_1
      http.begin("url_1");
      int httpCode = http.GET();
      if(httpCode &gt; 0)
      {
        String data = http.getString(); 
        const size_t bufferSize = JSON_ARRAY_SIZE(8) + 20;
        DynamicJsonBuffer jsonBuffer(bufferSize);
        JsonArray&amp; root = jsonBuffer.parseArray(data);
        for(int i=0;i&lt;8;i++){
          Data[i] = root[i];
          Serial.println("Printing whole Data");
          Serial.println(Data[i]);
        }
      }
      http.end();//ending the connetion
  
  
      for(int i=0;i&lt;8;i++)
      {
        if(strcmp(Data[i],"1")==0){
          Serial.print("if satement, Data = ");
          Serial.println(Data[i]);  
        }
        else
        {
          Serial.print("else satement, Data = ");
          Serial.println(Data[i]);
        }
      }
    }
  }
  </code></pre>