| 418 | |
| 419 | template <class TRapidJsonCompliantInputStream, class THandler> |
| 420 | bool ReadJson(TRapidJsonCompliantInputStream& is, const TJsonReaderConfig* config, THandler& handler, bool throwOnError) { |
| 421 | rapidjson::Reader reader; |
| 422 | |
| 423 | auto result = Read(*config, reader, is, handler); |
| 424 | |
| 425 | if (result.IsError()) { |
| 426 | if (throwOnError) { |
| 427 | ythrow TJsonException() << PrintError(result); |
| 428 | } else { |
| 429 | return false; |
| 430 | } |
| 431 | } |
| 432 | |
| 433 | return true; |
| 434 | } |
| 435 | |
| 436 | template <class TRapidJsonCompliantInputStream> |
| 437 | bool ReadJsonTree(TRapidJsonCompliantInputStream& is, const TJsonReaderConfig* config, TJsonValue* out, bool throwOnError) { |