diff options
author | yurial <yurial@yandex-team.com> | 2023-03-20 19:43:07 +0300 |
---|---|---|
committer | yurial <yurial@yandex-team.com> | 2023-03-20 19:43:07 +0300 |
commit | e619d6fcd974848970e32d14fa55508931ac359f (patch) | |
tree | ccaa109ce4500fa2e9a927a26283656ff32d6749 | |
parent | 6c10b73a14da5fc237bd6a9ad906128384a16ed3 (diff) | |
download | ydb-e619d6fcd974848970e32d14fa55508931ac359f.tar.gz |
fixup: now AllowComments worked prepertly when using non-stream prototype of Json2Proto
-rw-r--r-- | library/cpp/protobuf/json/json2proto.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/library/cpp/protobuf/json/json2proto.h b/library/cpp/protobuf/json/json2proto.h index ed89c6cf63..d576fabce7 100644 --- a/library/cpp/protobuf/json/json2proto.h +++ b/library/cpp/protobuf/json/json2proto.h @@ -202,6 +202,7 @@ namespace NProtobufJson { /// @throw yexception template <typename T> T Json2Proto(IInputStream& in, const TJson2ProtoConfig& config = TJson2ProtoConfig()) { + // NOTE: TJson2ProtoConfig.AllowComments=true doesn't work, when using TJsonReaderConfig NJson::TJsonReaderConfig readerConfig; readerConfig.DontValidateUtf8 = true; return Json2Proto<T>(in, readerConfig, config); @@ -210,15 +211,15 @@ namespace NProtobufJson { /// @throw yexception template <typename T> T Json2Proto(const TString& value, const TJson2ProtoConfig& config = TJson2ProtoConfig()) { - TStringInput in(value); - return Json2Proto<T>(in, config); + return Json2Proto<T>(TStringBuf(value), config); } /// @throw yexception template <typename T> T Json2Proto(const TStringBuf& value, const TJson2ProtoConfig& config = TJson2ProtoConfig()) { - TMemoryInput in(value); - return Json2Proto<T>(in, config); + T protoValue; + Json2Proto(value, protoValue, config); + return protoValue; } /// @throw yexception |