ESP32 Learn

SPIFFS/LittleFS: Read/Write JSON

2025-09-18 路 ~1 min read
Table of contents
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#include <FS.h>

#include <SPIFFS.h>

#include <ArduinoJson.h>

void setup() {
  Serial.begin(115200);
  SPIFFS.begin(true);
  DynamicJsonDocument doc(256);
  doc["ssid"] = "MyWiFi";
  doc["pw"] = "secret";
  File f = SPIFFS.open("/cfg.json", "w");
  serializeJson(doc, f);
  f.close();
}
void loop() {}

馃敄 #spiffs #littlefs #json