mirror of
https://gitlab.com/wirelos/sprocket-lib.git
synced 2025-12-14 12:46:50 +01:00
Add toCharArray method
This commit is contained in:
@@ -19,6 +19,7 @@ struct JsonStruct
|
||||
{
|
||||
return json.success();
|
||||
};
|
||||
|
||||
String toJsonString()
|
||||
{
|
||||
DynamicJsonBuffer jsonBuffer(JSON_ARRAY_SIZE(300));
|
||||
@@ -28,6 +29,16 @@ struct JsonStruct
|
||||
root.printTo(jsonString);
|
||||
return jsonString;
|
||||
}
|
||||
|
||||
char* toCharArray()
|
||||
{
|
||||
DynamicJsonBuffer jsonBuffer(JSON_ARRAY_SIZE(300));
|
||||
JsonObject &root = jsonBuffer.createObject();
|
||||
mapJsonObject(root);
|
||||
char jsonChar[jsonBuffer.size()];
|
||||
root.printTo((char*)jsonChar, root.measureLength() + 1);
|
||||
return jsonChar;
|
||||
}
|
||||
|
||||
String getAttrFromJson(JsonObject &json, const char *attr, String defautValue = "")
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user