PlatformIO ESP32經驗

pearlcity發表於2024-10-23
https://docs.platformio.org/en/latest/manifests/library-json/fields/dependencies.html

johboh/nlohmann-json

https://registry.platformio.org/libraries/johboh/nlohmann-json/installation
1、Depend on it 安裝庫:透過platformio.ini檔案新增
Open platformio.ini, a project configuration file located in the root of PlatformIO project.
Add the following line to the lib_deps option of [env:] section:
lib_deps = 
    ArduinoJson
    johboh/nlohmann-json@^3.11.3
Build a project, PlatformIO will automatically install dependencies.

2、Include it 引入庫
#include <nlohmann/json.hpp>
using JSON = nlohmann::json;

3、Command Line Interface  安裝庫:透過命令列新增
Open PlatformIO Core CLI
Change directory (cd) to the PlatformIO project where platformio.ini is located.
Copy the following pio pkg install command and paste into the CLI shell, press Enter:
pio pkg install --library "johboh/nlohmann-json@^3.11.3"







相關文章