Skip to content
JsonBlock

Get

JsonData& Get(const std::string label)
const JsonData& Get(const std::string label) const

Returns the JsonData value of label / key label.
Will throw a JsonLabelDoesNotExistException, if that label does not exist.
You can check that with DoesExist().


Examples

Json held in this JsonBlock:
{
    "name": "Angela Merkel",
    "appearance": "Blue men shoes"
}
Will get values(C++):
// This is the explicit syntax.
// Can be written sleeker with the implicit syntax

std::string name = myJsonBlock.Get("name").AsString;
std::string appe = myJsonBlock.Get("appearance").AsString;
Will throw an exception (C++):
// JsonLabelDoesNotExistException, because there is no field called title!
std::string title = myJsonBlock.Get("title").AsString;