Skip to content

Null value parsing

Latest
Compare
Choose a tag to compare
@IlikeChooros IlikeChooros released this 26 Feb 17:13
· 1 commit to main since this release

Allows null value parsing, for example:

extractor ex(
    "{\"key\": "
        "{"
            "\"subkey\": [\"hello\", 1.5, true],"
            "\"subkey2\": 2,"
            "\"subkey3\": 3,"
            "\"subNull\": null"
        "},"
    "\"key2\": \"value\"}"
);

String s = ex["random_key"].extract().as<String>();
int a = ex["key"]["subkey"][99].extract().as<int>();
float null = ex["key"]["subNull"].as<float>();

Code above is now perfectly fine (exception-free)
In previous versions it would cause an exception lazyjson::invalid_type since the types didn't match