Skip to content

JsonFilter problem #76

@phonicmouse

Description

@phonicmouse

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions