Skip to content
Snippets Groups Projects
protobuf.cc 416 B
Newer Older
  • Learn to ignore specific revisions
  • Daniel Lyubomirov's avatar
    Daniel Lyubomirov committed
    #include <vereign/grpc/json/encoder.hh>
    
    #include <util/protobuf.hh>
    
    #include <google/protobuf/util/json_util.h>
    
    
    #include <catch2/catch.hpp>
    
    
    namespace vereign {
    namespace test {
    
    
    auto ProtobufToJson(const google::protobuf::Message& msg) -> std::string {
      std::string result;
      grpc::json::Encode(msg, result, grpc::json::EncodeOptions{}.Pretty(2));
    
      return result;
    
    }
    
    } // namespace vereign
    } // namespace test