userver: /data/code/userver/libraries/protobuf/include/userver/protobuf/json/convert.hpp File Reference
Loading...
Searching...
No Matches
convert.hpp File Reference

Detailed Description

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.
 

Functions

formats::json::ValueBuilder protobuf::json::MessageToJsonBuilder (const ::google::protobuf::Message &message, const PrintOptions &options)
 Converts protobuf message to JSON ValueBuider.
 
formats::json::Value protobuf::json::MessageToJson (const ::google::protobuf::Message &message, const PrintOptions &options)
 Converts protobuf message to JSON Value.
 
void protobuf::json::JsonToMessage (const formats::json::Value &json, ::google::protobuf::Message &message, const ParseOptions &options={})
 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>>>
protobuf::json::JsonToMessage (const formats::json::Value &json, const ParseOptions &options={})
 Converts json to protobuf message of type T.