Skip to content

Instantly share code, notes, and snippets.

@bblanchon
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bblanchon/9228295 to your computer and use it in GitHub Desktop.
Save bblanchon/9228295 to your computer and use it in GitHub Desktop.
Test ArduinoJsonParser with openweathermap.org
char* json = "{\"coord\":{\"lon\":-0.13,\"lat\":51.51},\"sys\":{\"message\":0.0045,\"country\":\"GB\",\"sunrise\":1393397445,\"sunset\":1393436151},\"weather\":[{\"id\":802,\"main\":\"Clouds\",\"description\":\"scattered clouds\",\"icon\":\"03d\"}],\"base\":\"cmc stations\",\"main\":{\"temp\":283.27,\"pressure\":1014,\"humidity\":61,\"temp_min\":280.93,\"temp_max\":286.48},\"wind\":{\"speed\":5.7,\"deg\":270},\"clouds\":{\"all\":40},\"dt\":1393414204,\"id\":2643743,\"name\":\"London\",\"cod\":200}";
JsonParser<80> parser;
JsonHashTable root = parser.parseHashTable(json);
Serial.print("City = ");
Serial.println(root.getString("name"));
Serial.print("Weather = ");
Serial.println(root.getArray("weather").getHashTable(0).getString("main"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment