Last active
July 29, 2020 21:37
-
-
Save alexastrum/2e2fb3e94f7701938fe8bb677e4973ab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DynamicJsonDocument toJsonDocument(String str, int size = 0) { | |
| if (size == 0) { | |
| size = JSON_OBJECT_SIZE(1) + str.length(); | |
| } | |
| DynamicJsonDocument jsonDoc(str.length() * 2); | |
| DeserializationError error = deserializeJson(jsonDoc, str); | |
| if (error) { | |
| displayError("JSON " + String(error.c_str()) + ": " + str); | |
| jsonDoc.clear(); | |
| } | |
| return jsonDoc; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment