MCPcopy Create free account
hub / github.com/apache/brpc / ProtoMessageToJson

Function ProtoMessageToJson

src/json2pb/pb_to_json.cpp:378–390  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

376}
377
378bool ProtoMessageToJson(const google::protobuf::Message& message,
379 std::string* json,
380 const Pb2JsonOptions& options,
381 std::string* error) {
382 // TODO(gejun): We could further wrap a std::string as a buffer to reduce
383 // a copying.
384 BUTIL_RAPIDJSON_NAMESPACE::StringBuffer buffer;
385 if (json2pb::ProtoMessageToJsonStream(message, options, buffer, error)) {
386 json->append(buffer.GetString(), buffer.GetSize());
387 return true;
388 }
389 return false;
390}
391
392bool ProtoMessageToJson(const google::protobuf::Message& message,
393 std::string* json, std::string* error) {

Callers 10

CallAfterRpcMethod · 0.50
CallAfterRpcMethod · 0.50
CallAfterRpcMethod · 0.50
handle_responseMethod · 0.50
TEST_FFunction · 0.50
MakeResponseMessageMethod · 0.50
TEST_FFunction · 0.50
TEST_FFunction · 0.50
GenerateReportMethod · 0.50

Calls 5

ProtoMessageToJsonStreamFunction · 0.85
Pb2JsonOptionsClass · 0.85
GetStringMethod · 0.80
GetSizeMethod · 0.80
appendMethod · 0.45

Tested by 6

TEST_FFunction · 0.40
MakeResponseMessageMethod · 0.40
TEST_FFunction · 0.40
TEST_FFunction · 0.40
GenerateReportMethod · 0.40