JsonHelper
JSON processing utilities#include <JsonHelper.h>
Static Public Member Functions | |
| static DynamicJsonDocument | parseJson (const String &payload) |
| static DynamicJsonDocument | decodeResponse (const String &payload) |
| static bool | isValidJson (const DynamicJsonDocument &doc) |
| static String | getString (const DynamicJsonDocument &doc, const char *key, const String &defaultValue="") |
| static int | getInt (const DynamicJsonDocument &doc, const char *key, int defaultValue=0) |
| static bool | getBool (const DynamicJsonDocument &doc, const char *key, bool defaultValue=false) |
Member Function Documentation
◆ decodeResponse()
|
inlinestatic |
Parse HTTP response JSON payload Legacy method name for backward compatibility
- Parameters
| payload | HTTP response body containing JSON |
- Returns
- DynamicJsonDocument containing parsed data
◆ getBool()
|
inlinestatic |
Get boolean value from JSON with fallback
- Parameters
| doc | JSON document |
| key | Key to lookup |
| defaultValue | Default value if key not found |
- Returns
- Boolean value or default
◆ getInt()
|
inlinestatic |
Get integer value from JSON with fallback
- Parameters
| doc | JSON document |
| key | Key to lookup |
| defaultValue | Default value if key not found |
- Returns
- Integer value or default
◆ getString()
|
inlinestatic |
Get string value from JSON with fallback
- Parameters
| doc | JSON document |
| key | Key to lookup |
| defaultValue | Default value if key not found |
- Returns
- String value or default
◆ isValidJson()
|
inlinestatic |
Check if JSON document is valid (not empty)
- Parameters
| doc | JSON document to validate |
- Returns
- true if document contains valid data
◆ parseJson()
|
inlinestatic |
Parse JSON string into DynamicJsonDocument
- Parameters
| payload | JSON string to parse |
- Returns
- DynamicJsonDocument containing parsed data, or empty document on error