Let me add more details, here is what I have a test program:

test.proto:

syntax = "proto3";
package test;

message TestMessage {
    string query = 1;
    int32 page_number = 2;  // Which page number do we want?
    int32 result_per_page = 3;  // Number of results to return per page.
}

test::TestMessage message;
std::string output;
google::protobuf::util::MessageToJsonString(message, &output);
printf("Convert: %d %s\n", output.length(), output.c_str());

Convert: 2 {}





On Sunday, July 9, 2017 at 1:01:39 PM UTC+10, hce h wrote:
>
> Hi,
>
> I tried to call MessageToJsonString on Protobuf 3.3.0, but the output string 
> was empty, output = "{}". Has anyone made it work? If so, could you please 
> show me an example?
>
> Thank you.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to