|
10Duke Enterprise C++ SDK
|
#include <NJJSONParser.h>
Implementation of tenduke::json::JSONParser using nlohmann/json.
The nesting depth of JSON objects and arrays is limited, because the parsed document is converted (and later destroyed) recursively: Without the limit, deeply nested input from untrusted sources would overflow the stack.
Public Member Functions | |
| NJJSONParser (std::uint32_t maxDepth=DEFAULT_MAX_DEPTH) | |
| Constructs new instance. | |
| std::unique_ptr< JSONElement > | from (const char *jsonAsString, std::size_t length) const override |
| tenduke::json::JSONParser implementation | |
| std::unique_ptr< JSONElement > | from (const std::string &string) const override |
| Parses JSON from given string. | |
Static Public Attributes | |
| static const std::uint32_t | DEFAULT_MAX_DEPTH = 128 |
| Default maximum nesting depth of JSON objects and arrays. | |
|
explicit |
Constructs new instance.
| maxDepth | maximum nesting depth of JSON objects and arrays. Deeper input throws tenduke::json::JSONParsingException. |
|
overridevirtual |
tenduke::json::JSONParser implementation
Implements tenduke::json::JSONParser.
|
overridevirtual |
Parses JSON from given string.
| JSONParsingException | when the JSON parsing failed for various reasons. |
Implements tenduke::json::JSONParser.