I am using google protobuf’s JsonStringToMessage function from google/protobuf/json_util.h I have one json string (pod response). I want to convert/parse that json string response into kubernetes Pod message.
But, parsing is failing with error “invalid value “2023-08-11T07:37:33Z” for type type.googleapis.com/v1_25.k8s.io.apimachinery.pkg.apis.meta.v1.Time”
Sample code -
string rawData = watch.object().raw(); // Attached image
cout << rawData << endl;
v1_25::k8s::io::api::core::v1::Pod pod;
std::string jsonError;
JsonParseOptions options;
options.ignore_unknown_fields = true;
google::protobuf::util::Status status = JsonStringToMessage(rawData, &pod, options);
if( status.ok() )
{
cout << "success" << endl;
}
else cerr << "Failed" << status.error_message() << endl;