diff options
Diffstat (limited to 'library/cpp/json/writer/json_value.cpp')
| -rw-r--r-- | library/cpp/json/writer/json_value.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/library/cpp/json/writer/json_value.cpp b/library/cpp/json/writer/json_value.cpp index 6a0546fe043..22f2b2c07a2 100644 --- a/library/cpp/json/writer/json_value.cpp +++ b/library/cpp/json/writer/json_value.cpp @@ -455,6 +455,13 @@ namespace NJson { return Value.String; } + TString& TJsonValue::GetStringSafe() { + if (!IsString()) { + ythrow TJsonException() << "Not a string"; + } + return Value.String; + } + bool TJsonValue::GetBooleanSafe(const bool defaultValue) const { if (Type == JSON_UNDEFINED) { return defaultValue; |
