#include <ArduinoJson.h>
void setup() {
Serial.begin(115200);
//Тут фильтр, который разрешает конкретные параметры только принимать
static const char filter_arr[] PROGMEM = "{timezone:true,current:{temp:true,pressure:true,wind_speed:true,wind_deg:true,weather:[{id:true}]},daily:[{temp:{day:true,night:true},pressure:true,wind_speed:true,wind_deg:true,weather:[{id:true}]},{temp:{day:true,night:true},pressure:true,wind_speed:true,wind_deg:true,weather:[{id:true}]}]}";// 294 байта
//Тут прогноз на неделю
static const char Openweather_arr[] PROGMEM = "{\"lat\":47.81,\"lon\":35.0502,\"timezone\":\"Europe/Zaporozhye\",\"timezone_offset\":7200,\"current\":{\"dt\":1613079371,\"sunrise\":1613019158,\"sunset\":1613055337,\"temp\":6.84,\"feels_like\":3.08,\"pressure\":1005,\"humidity\":93,\"dew_point\":5.79,\"uvi\":0,\"clouds\":75,\"visibility\":10000,\"wind_speed\":4,\"wind_deg\":130,\"weather\":[{\"id\":803,\"main\":\"Clouds\",\"description\":\"облачно с прояснениями\",\"icon\":\"04n\"}]},\"daily\":[{\"dt\":1613034000,\"sunrise\":1613019158,\"sunset\":1613055337,\"temp\":{\"day\":4.22,\"min\":-1.15,\"max\":7.2,\"night\":6.84,\"eve\":6.57,\"morn\":-0.97},\"feels_like\":{\"day\":-0.65,\"night\":1.47,\"eve\":1.79,\"morn\":-4.1},\"pressure\":1013,\"humidity\":82,\"dew_point\":1.52,\"wind_speed\":4.43,\"wind_deg\":122,\"weather\":[{\"id\":803,\"main\":\"Clouds\",\"description\":\"облачно с прояснениями\",\"icon\":\"04d\"}],\"clouds\":72,\"pop\":0,\"uvi\":1.24},{\"dt\":1613120400,\"sunrise\":1613105462,\"sunset\":1613141832,\"temp\":{\"day\":4.55,\"min\":-10.07,\"max\":7.11,\"night\":-10.07,\"eve\":-6.96,\"morn\":5.97},\"feels_like\":{\"day\":0.09,\"night\":-18.74,\"eve\":-16.14,\"morn\":0.84},\"pressure\":1002,\"humidity\":87,\"dew_point\":2.65,\"wind_speed\":4.12,\"wind_deg\":275,\"weather\":[{\"id\":616,\"main\":\"Snow\",\"description\":\"снег с дождём\",\"icon\":\"13d\"}],\"clouds\":100,\"pop\":1,\"rain\":0.79,\"snow\":4.52,\"uvi\":0.56},{\"dt\":1613206800,\"sunrise\":1613191766,\"sunset\":1613228328,\"temp\":{\"day\":-8.83,\"min\":-10.38,\"max\":-8.400001,\"night\":-9.8,\"eve\":-8.87,\"morn\":-10.28},\"feels_like\":{\"day\":-19.05,\"night\":-17.98,\"eve\":-18.03,\"morn\":-19.23},\"pressure\":1014,\"humidity\":88,\"dew_point\":-14.05,\"wind_speed\":10.18,\"wind_deg\":251,\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"пасмурно\",\"icon\":\"04d\"}],\"clouds\":100,\"pop\":0.05,\"uvi\":1.46},{\"dt\":1613293200,\"sunrise\":1613278067,\"sunset\":1613314824,\"temp\":{\"day\":-8.63,\"min\":-10.51,\"max\":-7.75,\"night\":-9.82,\"eve\":-8.52,\"morn\":-10.22},\"feels_like\":{\"day\":-15.73,\"night\":-15.57,\"eve\":-14.47,\"morn\":-17.7},\"pressure\":1023,\"humidity\":89,\"dew_point\":-13.26,\"wind_speed\":5.77,\"wind_deg\":291,\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"пасмурно\",\"icon\":\"04d\"}],\"clouds\":100,\"pop\":0.15,\"uvi\":1.57},{\"dt\":1613379600,\"sunrise\":1613364368,\"sunset\":1613401319,\"temp\":{\"day\":-7.35,\"min\":-11.59,\"max\":-4.82,\"night\":-5.78,\"eve\":-6.69,\"morn\":-11.59},\"feels_like\":{\"day\":-11.64,\"night\":-10.32,\"eve\":-11.09,\"morn\":-16.38},\"pressure\":1026,\"humidity\":86,\"dew_point\":-13.67,\"wind_speed\":1.84,\"wind_deg\":263,\"weather\":[{\"id\":600,\"main\":\"Snow\",\"description\":\"небольшой снег\",\"icon\":\"13d\"}],\"clouds\":0,\"pop\":0.3,\"snow\":0.21,\"uvi\":1.53},{\"dt\":1613466000,\"sunrise\":1613450667,\"sunset\":1613487814,\"temp\":{\"day\":-5.81,\"min\":-8.24,\"max\":-4.88,\"night\":-8.24,\"eve\":-6.41,\"morn\":-7.34},\"feels_like\":{\"day\":-11.15,\"night\":-15.54,\"eve\":-12.8,\"morn\":-12.07},\"pressure\":1023,\"humidity\":93,\"dew_point\":-9.16,\"wind_speed\":3.65,\"wind_deg\":6,\"weather\":[{\"id\":600,\"main\":\"Snow\",\"description\":\"небольшой снег\",\"icon\":\"13d\"}],\"clouds\":88,\"pop\":0.28,\"snow\":0.14,\"uvi\":1.48},{\"dt\":1613552400,\"sunrise\":1613536965,\"sunset\":1613574309,\"temp\":{\"day\":-5.91,\"min\":-9.09,\"max\":-5.01,\"night\":-9.09,\"eve\":-6.53,\"morn\":-7.1},\"feels_like\":{\"day\":-14.61,\"night\":-16.93,\"eve\":-14.68,\"morn\":-14.54},\"pressure\":1021,\"humidity\":87,\"dew_point\":-11.97,\"wind_speed\":8.32,\"wind_deg\":26,\"weather\":[{\"id\":804,\"main\":\"Clouds\",\"description\":\"пасмурно\",\"icon\":\"04d\"}],\"clouds\":100,\"pop\":0,\"uvi\":2},{\"dt\":1613638800,\"sunrise\":1613623261,\"sunset\":1613660804,\"temp\":{\"day\":-8.58,\"min\":-11.84,\"max\":-6.88,\"night\":-11.84,\"eve\":-8.54,\"morn\":-10.81},\"feels_like\":{\"day\":-15.4,\"night\":-17.83,\"eve\":-15.04,\"morn\":-18.36},\"pressure\":1027,\"humidity\":84,\"dew_point\":-15.35,\"wind_speed\":5.29,\"wind_deg\":12,\"weather\":[{\"id\":803,\"main\":\"Clouds\",\"description\":\"облачно с прояснениями\",\"icon\":\"04d\"}],\"clouds\":76,\"pop\":0,\"uvi\":2}]}";
StaticJsonDocument<480> filter;
deserializeJson(filter, filter_arr);
serializeJsonPretty(filter, Serial); Serial.println("\n\n\n\n\nПогода:\n");
DynamicJsonDocument Answer(2048);
deserializeJson(Answer, Openweather_arr, DeserializationOption::Filter(filter));
serializeJsonPretty(Answer, Serial); Serial.println();
/*
const char* timezone = Answer["timezone"]; // "Europe/Zaporozhye"
JsonObject current = Answer["current"];
float current_temp = current["temp"]; // 6.84
int current_pressure = current["pressure"]; // 1005
int current_wind_speed = current["wind_speed"]; // 4
int current_wind_deg = current["wind_deg"]; // 130
int current_weather_0_id = current["weather"][0]["id"]; // 803
for (JsonObject elem : Answer["daily"].as<JsonArray>()) {
float temp_day = elem["temp"]["day"]; // 4.22, 4.55, -8.83, -8.63, -7.35, -5.81, -5.91, -8.58
float temp_night = elem["temp"]["night"]; // 6.84, -10.07, -9.8, -9.82, -5.78, -8.24, -9.09, -11.84
int pressure = elem["pressure"]; // 1013, 1002, 1014, 1023, 1026, 1023, 1021, 1027
float wind_speed = elem["wind_speed"]; // 4.43, 4.12, 10.18, 5.77, 1.84, 3.65, 8.32, 5.29
int wind_deg = elem["wind_deg"]; // 122, 275, 251, 291, 263, 6, 26, 12
int weather_0_id = elem["weather"][0]["id"]; // 803, 616, 804, 804, 600, 600, 804, 803
}
*/
}
void loop() {}