Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include"FS.h"
- #include <ESP8266WiFi.h>
- #include <ArduinoJson.h>
- //String file_name = "/config1.json"; // File of interest
- void setup() {
- WiFi.disconnect();
- Serial.begin(115200);
- while (!Serial);
- bool exist;
- bool ok = SPIFFS.begin();
- // Open file
- File file = SPIFFS.open("/config1.json","r");
- while(file.available())
- {
- StaticJsonBuffer<1024> jb;
- JsonArray& arr = jb.parseArray(file);
- for(int i=0;i<arr.size();i++)
- {
- JsonObject& forecast = arr[i]["forecast"];
- Serial.println(forecast["date"].as<char*>());
- Serial.println(forecast["text"].as<char*>());
- Serial.println(forecast["high"].as<int>());
- Serial.println(forecast["low"].as<int>());
- }
- }
- }
- void loop() {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement