9 #include <google/protobuf/message.h> 11 #include "util/status.h" 16 typedef std::function<std::string(const ::google::protobuf::FieldDescriptor& fd)> FieldNameCb;
18 typedef std::function<bool(const ::google::protobuf::FieldDescriptor& fd)> BoolAsIntegerPred;
20 bool enum_as_ints =
false;
22 FieldNameCb field_name_cb;
23 BoolAsIntegerPred bool_as_int;
26 std::string Pb2Json(const ::google::protobuf::Message& msg,
30 bool skip_unknown_fields;
35 Status Json2Pb(std::string json, ::google::protobuf::Message* msg,
const Json2PbOptions& options);
37 inline Status Json2Pb(std::string json, ::google::protobuf::Message* msg,
38 bool skip_unknown_fields =
true) {
39 return Json2Pb(std::move(json), msg,
Json2PbOptions(skip_unknown_fields));