mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-08-17 19:41:16 +02:00
Updated FAQ (markdown)
6
FAQ.md
6
FAQ.md
@@ -111,9 +111,11 @@ struct SensorData {
|
||||
float value;
|
||||
};
|
||||
|
||||
#define SENSORDATA_JSON_SIZE (JSON_OBJECT_SIZE(3))
|
||||
|
||||
bool deserialize(SensorData& data, const char* json)
|
||||
{
|
||||
StaticJsonBuffer<200> jsonBuffer;
|
||||
StaticJsonBuffer<SENSORDATA_JSON_SIZE> jsonBuffer;
|
||||
JsonObject& root = jsonBuffer.parseObject(json)
|
||||
data.name = json["name"];
|
||||
data.time = json["time"];
|
||||
@@ -123,7 +125,7 @@ bool deserialize(SensorData& data, const char* json)
|
||||
|
||||
void serialize(const SensorData& data, char* json, size_t maxSize)
|
||||
{
|
||||
StaticJsonBuffer<200> jsonBuffer;
|
||||
StaticJsonBuffer<SENSORDATA_JSON_SIZE> jsonBuffer;
|
||||
JsonObject& root = jsonBuffer.createObject()
|
||||
root["name"] = data.name;
|
||||
root["time"] = data.time;
|
||||
|
Reference in New Issue
Block a user