| 457 | |
| 458 | |
| 459 | Json::Value Response::GetJson() const |
| 460 | { |
| 461 | string str = GetString(); |
| 462 | |
| 463 | std::unique_ptr<Json::CharReader> reader(Json::CharReaderBuilder().newCharReader()); |
| 464 | string errors; |
| 465 | Json::Value value; |
| 466 | if (!reader->parse(str.data(), str.data() + str.size(), &value, &errors)) |
| 467 | { |
| 468 | throw std::runtime_error(std::string("Could not parse JSON: ") + errors.c_str()); |
| 469 | } |
| 470 | return value; |
| 471 | } |
| 472 | |
| 473 | |
| 474 | bool Response::GetJson(Json::Value& value) const noexcept |