cheliequan
2023-01-29 dccc1ca1304dc1fcb86c8e24edd491509269b3e7
util.cpp
@@ -32,7 +32,7 @@
bool proto_to_json(const google::protobuf::Message &message, std::string &json) {
    google::protobuf::util::JsonPrintOptions options;
    options.add_whitespace = true;
    options.add_whitespace = false;
    options.always_print_primitive_fields = true;
    options.preserve_proto_field_names = true;
@@ -125,7 +125,16 @@
    // Get root["data"]
    //yyjson_val *msg = yyjson_obj_get(root, "data");
    yyjson_val *data = yyjson_obj_get(root, data_name);
    yyjson_val *data;
    if ( NULL != data_name )
    {
        data = yyjson_obj_get(root, data_name);
    }
   else
   {
        data = root;
   }
    *ptr_type = yyjson_get_type(data);
    ptr_value = yyjson_val_write(data, YYJSON_WRITE_NOFLAG, &data_len);