Sounds like a job for Data::DPath:
#!/usr/bin/env perl
use strict;
use warnings;
use JSON::MaybeXS;
use Data::DPath 'dpath';
use Data::Dumper;
my $json = <<EOT;
{
"infra": {
"config": {
"rack": [
{
"componentId": "xxx-001",
"model": "xxx",
"server": [
{
"componentId": "server-001",
"type": "xxxx",
"model": "xxxx",
"role": "Management",
"specificAttributes": ""
}
]
}]
},
"platform": {
"config": {
"mgmtser": [{
"componentId": "sr-001",
"domainName": "xxxxx",
"thinDiskMode": true,
"deployment": "small"
}
]}
}
}
}
EOT
my $data = decode_json ($json);
my @res = dpath ('//*[ key eq "componentId"]/..')->match ($data);
print Dumper (\@res);