Reads a string JSON value with the given name from a parent JSON value.
| 240 | |
| 241 | /// Reads a string JSON value with the given name from a parent JSON value. |
| 242 | Status GetStringValue(const Json::Value& parent, const char* name, |
| 243 | string* result) { |
| 244 | Json::Value result_value; |
| 245 | TF_RETURN_IF_ERROR(GetValue(parent, name, &result_value)); |
| 246 | if (!result_value.isString()) { |
| 247 | return errors::Internal( |
| 248 | "The field '", name, |
| 249 | "' in the JSON response was expected to be a string."); |
| 250 | } |
| 251 | *result = result_value.asString(); |
| 252 | return Status::OK(); |
| 253 | } |
| 254 | |
| 255 | /// Reads a long JSON value with the given name from a parent JSON value. |
| 256 | Status GetInt64Value(const Json::Value& parent, const char* name, |
no test coverage detected