Utilities for converting protobuf messages to/from JSON ValueBuilder/Value according to ProtoJSON format.
Definition in file convert.hpp.
Go to the source code of this file.
#include <type_traits>#include <google/protobuf/message.h>#include <userver/formats/json/value.hpp>#include <userver/formats/json/value_builder.hpp>#include <userver/formats/parse/to.hpp>#include <userver/formats/serialize/to.hpp>#include <userver/protobuf/json/convert_options.hpp>#include <userver/protobuf/json/exceptions.hpp>Namespaces | |
| namespace | protobuf |
| Top namespace for the userver protobuf library. | |
| namespace | protobuf::json |
| Top namespace for the protobuf JSON utilities. | |
| namespace | formats |
| Value formats representation, parsing and serialization. | |
| namespace | formats::serialize |
| Common serializers. | |
| namespace | formats::parse |
| Generic parsers and converters. | |
Functions | |
| formats::json::ValueBuilder | protobuf::json::MessageToJsonBuilder (const ::google::protobuf::Message &message, const WriteOptions &options={}) |
Converts protobuf message to JSON ValueBuider. | |
| formats::json::Value | protobuf::json::MessageToJson (const ::google::protobuf::Message &message, const WriteOptions &options={}) |
Converts protobuf message to JSON Value. | |
| void | protobuf::json::JsonToMessage (const formats::json::Value &json, const ReadOptions &options, ::google::protobuf::Message &message) |
| Converts json to protobuf message . | |
| template<typename T , typename = std::enable_if_t< std::is_base_of_v<::google::protobuf::Message, T> || !std::is_same_v<::google::protobuf::Message, T>>> | |
| T | protobuf::json::JsonToMessage (const formats::json::Value &json, const ReadOptions &options={}) |
Converts json to protobuf message of type T. | |
| json::Value | formats::serialize::Serialize (const google::protobuf::Message &message, To< json::Value >) |
Conversion from any google::protobuf::Message to formats::json::Value. Uses the ProtoJSON format in the same way as protobuf::MessageToJson called with a default options. | |
| template<typename TMessage , typename = std::enable_if_t< std::is_base_of_v<::google::protobuf::Message, TMessage> && !std::is_same_v<::google::protobuf::Message, TMessage>>> | |
| TMessage | formats::parse::Parse (const json::Value &value, To< TMessage >) |
Conversion from formats::json::Value to google::protobuf::Message. Uses the ProtoJSON format in the same way as protobuf::JsonToMessage called with a default options. | |