interactive-matter / aJson

aJson is an Arduino library to enable JSON processing with Arduino. It easily enables you to decode, create, manipulate and encode JSON directly from and to data structures.
http://interactive-matter.org/2010/08/ajson-handle-json-with-arduino/
567 stars 136 forks source link

JsonFilter problem #76

Open phonicmouse opened 8 years ago

phonicmouse commented 8 years ago

when i'm compiling this:

HTTPClient client("api.openweathermap.org", weatherApiServer);

    FILE* result = client.getURI("/data/2.5/weather?q=torino&appid=217fd2d8848ef3352b55a089f72a5e55");

    int returnCode = client.getLastReturnCode();
if (result != NULL) {
      int c;
      float tempK;
      float tempC;
      String response;

      while ((c = fgetc(result)) != EOF) {
        response += (char) c;
      }
      char* json_string;
      response.toCharArray(json_string, response.length());
      char** jsonFilter = {"main", "temp", "pressure", "humidity", NULL};
      aJsonObject* stream = aJson.parse(result, jsonFilter);
}

i get the following error:

Arduino:1.6.6 (Windows 10), Scheda:"Arduino/Genuino Uno"

C:\Users\Phonic Mouse\Documents\Arduino\ArduMeteoTwitter\ArduMeteo\ArduMeteo.ino: In function 'void loop()':

C:\Users\Phonic Mouse\Documents\Arduino\ArduMeteoTwitter\ArduMeteo\ArduMeteo.ino:60:65: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     HTTPClient client("api.openweathermap.org", weatherApiServer);

                                                                 ^

C:\Users\Phonic Mouse\Documents\Arduino\ArduMeteoTwitter\ArduMeteo\ArduMeteo.ino:62:101: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

     FILE* result = client.getURI("/data/2.5/weather?q=torino&appid=217fd2d8848ef3352b55a089f72a5e55");

                                                                                                     ^

ArduMeteo:77: error: scalar object 'jsonFilter' requires one element in initializer

       char** jsonFilter = {"main", "temp", "pressure", "humidity", NULL};

                                                                        ^

exit status 1

scalar object 'jsonFilter' requires one element in initializer