| | |
| | | |
| | | 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; |
| | | |
| | |
| | | |
| | | // 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); |