Json庫
json library from github arduino Json
Github arduino json wiki | JSON Library 論壇簡介貼地址
download from the address:zip address
Welcome to the user manual for the Arduino JSON library, an elegant and efficient JSON library for embedded systems. It's designed to have the most intuitive API, the smallest footprint and works without any allocation on the heap (no malloc). It has been written with Arduino in mind, but it isn't linked to Arduino libraries so you can use this library in any other C++ project. Using the library with Arduino
Examples
|
- StaticJsonBuffer<200> jsonBuffer; 為JSON對象樹創建內存池(在棧上分配內存) 參數
- DynamicJsonBuffer jsonBuffer; 為JSON對象樹創建內存池(在堆上分配內存)- 簡單但效率低 - JsonObject& root = jsonBuffer.createObject(); 創建對象樹的根 - root["sensor"] = "gps"; 在對象中添加值 參數
- JsonArray& data = root.createNestedArray("data"); 在對象中添加一個嵌套的數組 參數
- data.add(double_with_n_digits(48.756080, 6)); 給data數組添加值 參數
- root.printTo(Serial); 列印輸出 參數
例:{"sensor":"gps","time":1351824120,"data":[48.756080,2.302038]}
列印輸出(格式)
|
更多建議和問題歡迎反饋至 YFRobot論壇