1#include <userver/proto-structs/io/userver/formats/json/value_conv.hpp>
3#include <google/protobuf/struct.pb.h>
5#include <userver/proto-structs/io/context.hpp>
6#include <userver/protobuf/json/convert.hpp>
10namespace proto_structs::io {
12formats::json::Value ReadProtoStruct(ReadContext& ctx, To<formats::json::Value>,
const ::google::protobuf::Value& msg) {
14 return protobuf::json::MessageToJson(msg, protobuf::json::PrintOptions{});
15 }
catch (
const protobuf::json::PrintError& e) {
16 ctx.AddError(e.what());
17 return formats::json::Value{};
21void WriteProtoStruct(WriteContext&,
const formats::json::Value& obj, ::google::protobuf::Value& msg) {
22 protobuf::json::JsonToMessage(obj, msg, protobuf::json::ParseOptions{});