arraysjsonperlhash-of-hashes

Multidimensional array or hashes in Perl. Access items


Newbuy's question.

I have json file which looks like this:

{
    "Controllers":[
    {
            "Command Status" : {
                    "Controller" : 0,
                    "Status" : "Success",
                    "Description" : "None"
            },
            "Response Data" : {
                    "Product Name" : "LSI MegaRAID SAS 9260-8i",
                    "Serial Number" : "SV30408696",
                    "SAS Address" : " 500605b005c557f0",
                    "PCI Address" : "00:01:00:00",
                    "System Time" : "11/02/2020 01:15:01",
                    "Mfg. Date" : "01/23/13",
                    "Controller Time" : "11/02/2020 08:03:07",
                    "FW Package Build" : "12.15.0-0239",
                    "FW Version" : "2.130.403-4660",
                    "BIOS Version" : "3.30.02.2_4.16.08.00_0x06060A05",
                    "Driver Name" : "megaraid_sas",
                    "Driver Version" : "07.703.05.00-rc1",
                    "Vendor Id" : 4096,
                    "Device Id" : 121,
                    "SubVendor Id" : 4096,
                    "SubDevice Id" : 37473,
                    "Host Interface" : "PCI-E",
                    "Device Interface" : "SAS-6G",
                    "Bus Number" : 1,
                    "Device Number" : 0,
                    "Function Number" : 0,
                    "Drive Groups" : 6,
                    "TOPOLOGY" : [
                            {
                                    "DG" : 0,
                                    "Arr" : "-",
                                    "Row" : "-",
                                    "EID:Slot" : "-",
                                    "DID" : "-",
                                    "Type" : "RAID1",
                                    "State" : "Optl",
                                    "BT" : "N",
                                    "Size" : "465.25 GB",
                                    "PDC" : "dflt",
                                    "PI" : "N",
                                    "SED" : "N",
                                    "DS3" : "none",
                                    "FSpace" : "N",
                                    "TR" : "N"
                            },
                            {
                                    "DG" : 0,
                                    "Arr" : 0,
                                    "Row" : "-",
                                    "EID:Slot" : "-",
                                    "DID" : "-",
                                    "Type" : "RAID1",
                                    "State" : "Optl",
                                    "BT" : "N",
                                    "Size" : "465.25 GB",
                                    "PDC" : "dflt",
                                    "PI" : "N",
                                    "SED" : "N",
                                    "DS3" : "none",
                                    "FSpace" : "N",
                                    "TR" : "N"
                            },
                            {
                                    "DG" : 0,
                                    "Arr" : 0,
                                    "Row" : 0,
                                    "EID:Slot" : "252:1",
                                    "DID" : 8,
                                    "Type" : "DRIVE",
                                    "State" : "Onln",
                                    "BT" : "N",
                                    "Size" : "465.25 GB",
                                    "PDC" : "dflt",
                                    "PI" : "N",
                                    "SED" : "N",
                                    "DS3" : "none",
                                    "FSpace" : "-",
                                    "TR" : "N"
                            },
                            {
                                    "DG" : 0,
                                    "Arr" : 0,
                                    "Row" : 1,
                                    "EID:Slot" : "252:0",
                                    "DID" : 9,
                                    "Type" : "DRIVE",
                                    "State" : "Onln",
                                    "BT" : "N",
                                    "Size" : "465.25 GB",
                                    "PDC" : "dflt",
                                    "PI" : "N",
                                    "SED" : "N",
                                    "DS3" : "none",
                                    "FSpace" : "-",
                                    "TR" : "N"
                            },
                            {
                                    "DG" : 1,
                                    "Arr" : "-",
                                    "Row" : "-",
                                    "EID:Slot" : "-",
                                    "DID" : "-",
                                    "Type" : "RAID0",
                                    "State" : "Optl",
                                    "BT" : "N",
                                    "Size" : "3.637 TB",
                                    "PDC" : "dflt",
                                    "PI" : "N",
                                    "SED" : "N",
                                    "DS3" : "none",
                                    "FSpace" : "N",
                                    "TR" : "N"
                            },
                            {
                                    "DG" : 1,
                                    "Arr" : 0,
                                    "Row" : "-",
                                    "EID:Slot" : "-",
                                    "DID" : "-",
                                    "Type" : "RAID0",
                                    "State" : "Optl",
                                    "BT" : "N",
                                    "Size" : "3.637 TB",
                                    "PDC" : "dflt",
                                    "PI" : "N",
                                    "SED" : "N",
                                    "DS3" : "none",
                                    "FSpace" : "N",
                                    "TR" : "N"
                            },
                            {
                                    "DG" : 1,
                                    "Arr" : 0,
                                    "Row" : 0,
                                    "EID:Slot" : "252:2",
                                    "DID" : 10,
                                    "Type" : "DRIVE",
                                    "State" : "Onln",
                                    "BT" : "N",
                                    "Size" : "3.637 TB",
                                    "PDC" : "dflt",
                                    "PI" : "N",
                                    "SED" : "N",
                                    "DS3" : "none",
                                    "FSpace" : "-",
                                    "TR" : "N"
                            },
                            {
                                    "DG" : 2,
                                    "Arr" : "-",
                                    "Row" : "-",
                                    "EID:Slot" : "-",
                                    "DID" : "-",
                                    "Type" : "RAID0",
                                    "State" : "Optl",
                                    "BT" : "N",
                                    "Size" : "3.637 TB",
                                    "PDC" : "dflt",
                                    "PI" : "N",
                                    "SED" : "N",
                                    "DS3" : "none",
                                    "FSpace" : "N",
                                    "TR" : "N"
                            },
                            {
                                    "DG" : 2,
                                    "Arr" : 0,
                                    "Row" : "-",
                                    "EID:Slot" : "-",
                                    "DID" : "-",
                                    "Type" : "RAID0",
                                    "State" : "Optl",
                                    "BT" : "N",
                                    "Size" : "3.637 TB",
                                    "PDC" : "dflt",
                                    "PI" : "N",
                                    "SED" : "N",
                                    "DS3" : "none",
                                    "FSpace" : "N",
                                    "TR" : "N"
                            },
                            {
                                    "DG" : 2,
                                    "Arr" : 0,
                                    "Row" : 0,
                                    "EID:Slot" : "252:3",
                                    "DID" : 11,
                                    "Type" : "DRIVE",
                                    "State" : "Onln",
                                    "BT" : "N",
                                    "Size" : "3.637 TB",
                                    "PDC" : "dflt",
                                    "PI" : "N",
                                    "SED" : "N",
                                    "DS3" : "none",
                                    "FSpace" : "-",
                                    "TR" : "N"
                            },
                            {
                                    "DG" : 3,
                                    "Arr" : "-",
                                    "Row" : "-",
                                    "EID:Slot" : "-",
                                    "DID" : "-",
                                    "Type" : "RAID0",
                                    "State" : "Optl",
                                    "BT" : "N",
                                    "Size" : "3.637 TB",
                                    "PDC" : "dflt",
                                    "PI" : "N",
                                    "SED" : "N",
                                    "DS3" : "none",
                                    "FSpace" : "N",
                                    "TR" : "N"
                            },
                            {
                                    "DG" : 3,
                                    "Arr" : 0,
                                    "Row" : "-",
                                    "EID:Slot" : "-",
                                    "DID" : "-",
                                    "Type" : "RAID0",
                                    "State" : "Optl",
                                    "BT" : "N",
                                    "Size" : "3.637 TB",
                                    "PDC" : "dflt",
                                    "PI" : "N",
                                    "SED" : "N",
                                    "DS3" : "none",
                                    "FSpace" : "N",
                                    "TR" : "N"
                            },
                            {
                                    "DG" : 3,
                                    "Arr" : 0,
                                    "Row" : 0,
                                    "EID:Slot" : "252:4",
                                    "DID" : 13,
                                    "Type" : "DRIVE",
                                    "State" : "Onln",
                                    "BT" : "N",
                                    "Size" : "3.637 TB",
                                    "PDC" : "dflt",
                                    "PI" : "N",
                                    "SED" : "N",
                                    "DS3" : "none",
                                    "FSpace" : "-",
                                    "TR" : "N"
                            },
                            {
                                    "DG" : 4,
                                    "Arr" : "-",
                                    "Row" : "-",
                                    "EID:Slot" : "-",
                                    "DID" : "-",
                                    "Type" : "RAID0",
                                    "State" : "Optl",
                                    "BT" : "N",
                                    "Size" : "3.637 TB",
                                    "PDC" : "dflt",
                                    "PI" : "N",
                                    "SED" : "N",
                                    "DS3" : "none",
                                    "FSpace" : "N",
                                    "TR" : "N"
                            },
                            {
                                    "DG" : 4,
                                    "Arr" : 0,
                                    "Row" : "-",
                                    "EID:Slot" : "-",
                                    "DID" : "-",
                                    "Type" : "RAID0",
                                    "State" : "Optl",
                                    "BT" : "N",
                                    "Size" : "3.637 TB",
                                    "PDC" : "dflt",
                                    "PI" : "N",
                                    "SED" : "N",
                                    "DS3" : "none",
                                    "FSpace" : "N",
                                    "TR" : "N"
                            },
                            {
                                    "DG" : 4,
                                    "Arr" : 0,
                                    "Row" : 0,
                                    "EID:Slot" : "252:5",
                                    "DID" : 14,
                                    "Type" : "DRIVE",
                                    "State" : "Onln",
                                    "BT" : "N",
                                    "Size" : "3.637 TB",
                                    "PDC" : "dflt",
                                    "PI" : "N",
                                    "SED" : "N",
                                    "DS3" : "none",
                                    "FSpace" : "-",
                                    "TR" : "N"
                            },
                            {
                                    "DG" : 5,
                                    "Arr" : "-",
                                    "Row" : "-",
                                    "EID:Slot" : "-",
                                    "DID" : "-",
                                    "Type" : "RAID0",
                                    "State" : "Optl",
                                    "BT" : "N",
                                    "Size" : "3.637 TB",
                                    "PDC" : "dflt",
                                    "PI" : "N",
                                    "SED" : "N",
                                    "DS3" : "none",
                                    "FSpace" : "N",
                                    "TR" : "N"
                            },
                            {
                                    "DG" : 5,
                                    "Arr" : 0,
                                    "Row" : "-",
                                    "EID:Slot" : "-",
                                    "DID" : "-",
                                    "Type" : "RAID0",
                                    "State" : "Optl",
                                    "BT" : "N",
                                    "Size" : "3.637 TB",
                                    "PDC" : "dflt",
                                    "PI" : "N",
                                    "SED" : "N",
                                    "DS3" : "none",
                                    "FSpace" : "N",
                                    "TR" : "N"
                            },
                            {
                                    "DG" : 5,
                                    "Arr" : 0,
                                    "Row" : 0,
                                    "EID:Slot" : "252:6",
                                    "DID" : 15,
                                    "Type" : "DRIVE",
                                    "State" : "Onln",
                                    "BT" : "N",
                                    "Size" : "3.637 TB",
                                    "PDC" : "dflt",
                                    "PI" : "N",
                                    "SED" : "N",
                                    "DS3" : "none",
                                    "FSpace" : "-",
                                    "TR" : "N"
                            }
                    ],
                    "Virtual Drives" : 6,
                    "VD LIST" : [
                            {
                                    "DG/VD" : "0/0",
                                    "TYPE" : "RAID1",
                                    "State" : "Optl",
                                    "Access" : "RW",
                                    "Consist" : "Yes",
                                    "Cache" : "RWTD",
                                    "Cac" : "-",
                                    "sCC" : "ON",
                                    "Size" : "465.25 GB",
                                    "Name" : ""
                            },
                            {
                                    "DG/VD" : "1/1",
                                    "TYPE" : "RAID0",
                                    "State" : "Optl",
                                    "Access" : "RW",
                                    "Consist" : "Yes",
                                    "Cache" : "RWTD",
                                    "Cac" : "-",
                                    "sCC" : "ON",
                                    "Size" : "3.637 TB",
                                    "Name" : ""
                            },
                            {
                                    "DG/VD" : "2/2",
                                    "TYPE" : "RAID0",
                                    "State" : "Optl",
                                    "Access" : "RW",
                                    "Consist" : "Yes",
                                    "Cache" : "RWTD",
                                    "Cac" : "-",
                                    "sCC" : "ON",
                                    "Size" : "3.637 TB",
                                    "Name" : ""
                            },
                            {
                                    "DG/VD" : "3/3",
                                    "TYPE" : "RAID0",
                                    "State" : "Optl",
                                    "Access" : "RW",
                                    "Consist" : "Yes",
                                    "Cache" : "RWTD",
                                    "Cac" : "-",
                                    "sCC" : "ON",
                                    "Size" : "3.637 TB",
                                    "Name" : ""
                            },
                            {
                                    "DG/VD" : "4/4",
                                    "TYPE" : "RAID0",
                                    "State" : "Optl",
                                    "Access" : "RW",
                                    "Consist" : "Yes",
                                    "Cache" : "RWTD",
                                    "Cac" : "-",
                                    "sCC" : "ON",
                                    "Size" : "3.637 TB",
                                    "Name" : ""
                            },
                            {
                                    "DG/VD" : "5/5",
                                    "TYPE" : "RAID0",
                                    "State" : "Optl",
                                    "Access" : "RW",
                                    "Consist" : "Yes",
                                    "Cache" : "RWTD",
                                    "Cac" : "-",
                                    "sCC" : "ON",
                                    "Size" : "3.637 TB",
                                    "Name" : ""
                            }
                    ],
                    "Physical Drives" : 7,
                    "PD LIST" : [
                            {
                                    "EID:Slt" : "252:0",
                                    "DID" : 9,
                                    "State" : "Onln",
                                    "DG" : 0,
                                    "Size" : "465.25 GB",
                                    "Intf" : "SATA",
                                    "Med" : "HDD",
                                    "SED" : "N",
                                    "PI" : "N",
                                    "SeSz" : "512B",
                                    "Model" : "ST500DM002-1BD142",
                                    "Sp" : "U",
                                    "Type" : "-"
                            },
                            {
                                    "EID:Slt" : "252:1",
                                    "DID" : 8,
                                    "State" : "Onln",
                                    "DG" : 0,
                                    "Size" : "465.25 GB",
                                    "Intf" : "SATA",
                                    "Med" : "HDD",
                                    "SED" : "N",
                                    "PI" : "N",
                                    "SeSz" : "512B",
                                    "Model" : "ST500DM002-1BD142",
                                    "Sp" : "U",
                                    "Type" : "-"
                            },
                            {
                                    "EID:Slt" : "252:2",
                                    "DID" : 10,
                                    "State" : "Onln",
                                    "DG" : 1,
                                    "Size" : "3.637 TB",
                                    "Intf" : "SATA",
                                    "Med" : "HDD",
                                    "SED" : "N",
                                    "PI" : "N",
                                    "SeSz" : "512B",
                                    "Model" : "ST4000NM0033-9ZM170",
                                    "Sp" : "U",
                                    "Type" : "-"
                            },
                            {
                                    "EID:Slt" : "252:3",
                                    "DID" : 11,
                                    "State" : "Onln",
                                    "DG" : 2,
                                    "Size" : "3.637 TB",
                                    "Intf" : "SATA",
                                    "Med" : "HDD",
                                    "SED" : "N",
                                    "PI" : "N",
                                    "SeSz" : "512B",
                                    "Model" : "ST4000NM0033-9ZM170",
                                    "Sp" : "U",
                                    "Type" : "-"
                            },
                            {
                                    "EID:Slt" : "252:4",
                                    "DID" : 13,
                                    "State" : "Onln",
                                    "DG" : 3,
                                    "Size" : "3.637 TB",
                                    "Intf" : "SATA",
                                    "Med" : "HDD",
                                    "SED" : "N",
                                    "PI" : "N",
                                    "SeSz" : "512B",
                                    "Model" : "ST4000NM0033-9ZM170",
                                    "Sp" : "U",
                                    "Type" : "-"
                            },
                            {
                                    "EID:Slt" : "252:5",
                                    "DID" : 14,
                                    "State" : "Onln",
                                    "DG" : 4,
                                    "Size" : "3.637 TB",
                                    "Intf" : "SATA",
                                    "Med" : "HDD",
                                    "SED" : "N",
                                    "PI" : "N",
                                    "SeSz" : "512B",
                                    "Model" : "ST4000NM0033-9ZM170",
                                    "Sp" : "U",
                                    "Type" : "-"
                            },
                            {
                                    "EID:Slt" : "252:6",
                                    "DID" : 15,
                                    "State" : "Onln",
                                    "DG" : 5,
                                    "Size" : "3.637 TB",
                                    "Intf" : "SATA",
                                    "Med" : "HDD",
                                    "SED" : "N",
                                    "PI" : "N",
                                    "SeSz" : "512B",
                                    "Model" : "ST4000NM0033-9ZM170",
                                    "Sp" : "U",
                                    "Type" : "-"
                            }
                    ]
            }
    }
    ]
    }

This is log of RAID controller test. And task sounds like this: check all virtual drives (their state) and each disk in each virtual drive and disks' state.

Now I can't even understand how to access top level items. Tried lots of options but totally don't understand. One of code examples:

#!/usr/bin/perl
use strict;
use warnings;
use JSON::XS;
use File::Slurp;
use Data::Dumper;

my $json_source = "state.json";   

my $json = read_file( $json_source ) or die "Couldn't read the file";
my $json_array = decode_json $json or die "Couldn't recognize JSON";

foreach my $item( %$json_array{Controllers} ) { 
    print Dumper($item->{'Command status'});
}

Would be very appreciated for help with understanding or code examples. As I see spaces in names of keys of 2nd level of json can be a problem. And besides, what does decode_json() totally return - link to what? To hash, to array, to array of hashes? It cannot be so complicated - I saw python example of working with this same json - it looks very simple (and it really is). Help please.


Solution

  • Input data represent complex structure. We need to extract only information of interest.

    This can be achieved by utilizing an arrays with fields of interest. As the data placed into an array we have to loop through the arrays.

    Please investigate following code with compliance for your task.

    use strict;
    use warnings;
    use feature 'say';
    
    use JSON;
    
    my $data = do { local $/; <DATA> };
    my $struct = from_json($data);
    
    my @product  = ('Product Name','Serial Number','System Time','Controller Time',
                    'Mfg. Date','FW Package Build','FW Version','BIOS Version',
                    'Driver Name','Driver Version','Host Interface','Device Interface'
                    );
    my @status   = qw/Controller Status Description/;
    my @v_fields = ('DG/VD','TYPE','State','Access','Size','Name');
    my @p_fields = ('DG','DID','State','Med','Intf','Size','Model');
    
    for my $c ( @{ $struct->{Controllers} } ) {
        say '--- Status '  . '-' x 45;
        printf "%-12s %s\n", $_, $c->{'Command Status'}{$_} for @status;
    
        say '--- Product ' . '-' x 44;
        printf "%-18s %s\n", $_, $c->{'Response Data'}{$_}  for @product;
    
        say '--- Virtual ' . '-' x 60;
        say join "\t", @v_fields;
        for my $vd ( @{ $c->{'Response Data'}{'VD LIST'} } ) {
            say join "\t", $vd->@{@v_fields};
        }
    
        say '--- Physical ' . '-' x 60;
        say join "\t", @p_fields;
        for my $pd ( @{ $c->{'Response Data'}{'PD LIST'} } ) {
            say join "\t", $pd->@{@p_fields};
        }
    }
                               
    __DATA__
    {
        "Controllers":[
        {
                "Command Status" : {
                        "Controller" : 0,
                        "Status" : "Success",
                        "Description" : "None"
                },
                "Response Data" : {
                        "Product Name" : "LSI MegaRAID SAS 9260-8i",
                        "Serial Number" : "SV30408696",
                        "SAS Address" : " 500605b005c557f0",
                        "PCI Address" : "00:01:00:00",
                        "System Time" : "11/02/2020 01:15:01",
                        "Mfg. Date" : "01/23/13",
                        "Controller Time" : "11/02/2020 08:03:07",
                        "FW Package Build" : "12.15.0-0239",
                        "FW Version" : "2.130.403-4660",
                        "BIOS Version" : "3.30.02.2_4.16.08.00_0x06060A05",
                        "Driver Name" : "megaraid_sas",
                        "Driver Version" : "07.703.05.00-rc1",
                        "Vendor Id" : 4096,
                        "Device Id" : 121,
                        "SubVendor Id" : 4096,
                        "SubDevice Id" : 37473,
                        "Host Interface" : "PCI-E",
                        "Device Interface" : "SAS-6G",
                        "Bus Number" : 1,
                        "Device Number" : 0,
                        "Function Number" : 0,
                        "Drive Groups" : 6,
                        "TOPOLOGY" : [
                                {
                                        "DG" : 0,
                                        "Arr" : "-",
                                        "Row" : "-",
                                        "EID:Slot" : "-",
                                        "DID" : "-",
                                        "Type" : "RAID1",
                                        "State" : "Optl",
                                        "BT" : "N",
                                        "Size" : "465.25 GB",
                                        "PDC" : "dflt",
                                        "PI" : "N",
                                        "SED" : "N",
                                        "DS3" : "none",
                                        "FSpace" : "N",
                                        "TR" : "N"
                                },
                                {
                                        "DG" : 0,
                                        "Arr" : 0,
                                        "Row" : "-",
                                        "EID:Slot" : "-",
                                        "DID" : "-",
                                        "Type" : "RAID1",
                                        "State" : "Optl",
                                        "BT" : "N",
                                        "Size" : "465.25 GB",
                                        "PDC" : "dflt",
                                        "PI" : "N",
                                        "SED" : "N",
                                        "DS3" : "none",
                                        "FSpace" : "N",
                                        "TR" : "N"
                                },
                                {
                                        "DG" : 0,
                                        "Arr" : 0,
                                        "Row" : 0,
                                        "EID:Slot" : "252:1",
                                        "DID" : 8,
                                        "Type" : "DRIVE",
                                        "State" : "Onln",
                                        "BT" : "N",
                                        "Size" : "465.25 GB",
                                        "PDC" : "dflt",
                                        "PI" : "N",
                                        "SED" : "N",
                                        "DS3" : "none",
                                        "FSpace" : "-",
                                        "TR" : "N"
                                },
                                {
                                        "DG" : 0,
                                        "Arr" : 0,
                                        "Row" : 1,
                                        "EID:Slot" : "252:0",
                                        "DID" : 9,
                                        "Type" : "DRIVE",
                                        "State" : "Onln",
                                        "BT" : "N",
                                        "Size" : "465.25 GB",
                                        "PDC" : "dflt",
                                        "PI" : "N",
                                        "SED" : "N",
                                        "DS3" : "none",
                                        "FSpace" : "-",
                                        "TR" : "N"
                                },
                                {
                                        "DG" : 1,
                                        "Arr" : "-",
                                        "Row" : "-",
                                        "EID:Slot" : "-",
                                        "DID" : "-",
                                        "Type" : "RAID0",
                                        "State" : "Optl",
                                        "BT" : "N",
                                        "Size" : "3.637 TB",
                                        "PDC" : "dflt",
                                        "PI" : "N",
                                        "SED" : "N",
                                        "DS3" : "none",
                                        "FSpace" : "N",
                                        "TR" : "N"
                                },
                                {
                                        "DG" : 1,
                                        "Arr" : 0,
                                        "Row" : "-",
                                        "EID:Slot" : "-",
                                        "DID" : "-",
                                        "Type" : "RAID0",
                                        "State" : "Optl",
                                        "BT" : "N",
                                        "Size" : "3.637 TB",
                                        "PDC" : "dflt",
                                        "PI" : "N",
                                        "SED" : "N",
                                        "DS3" : "none",
                                        "FSpace" : "N",
                                        "TR" : "N"
                                },
                                {
                                        "DG" : 1,
                                        "Arr" : 0,
                                        "Row" : 0,
                                        "EID:Slot" : "252:2",
                                        "DID" : 10,
                                        "Type" : "DRIVE",
                                        "State" : "Onln",
                                        "BT" : "N",
                                        "Size" : "3.637 TB",
                                        "PDC" : "dflt",
                                        "PI" : "N",
                                        "SED" : "N",
                                        "DS3" : "none",
                                        "FSpace" : "-",
                                        "TR" : "N"
                                },
                                {
                                        "DG" : 2,
                                        "Arr" : "-",
                                        "Row" : "-",
                                        "EID:Slot" : "-",
                                        "DID" : "-",
                                        "Type" : "RAID0",
                                        "State" : "Optl",
                                        "BT" : "N",
                                        "Size" : "3.637 TB",
                                        "PDC" : "dflt",
                                        "PI" : "N",
                                        "SED" : "N",
                                        "DS3" : "none",
                                        "FSpace" : "N",
                                        "TR" : "N"
                                },
                                {
                                        "DG" : 2,
                                        "Arr" : 0,
                                        "Row" : "-",
                                        "EID:Slot" : "-",
                                        "DID" : "-",
                                        "Type" : "RAID0",
                                        "State" : "Optl",
                                        "BT" : "N",
                                        "Size" : "3.637 TB",
                                        "PDC" : "dflt",
                                        "PI" : "N",
                                        "SED" : "N",
                                        "DS3" : "none",
                                        "FSpace" : "N",
                                        "TR" : "N"
                                },
                                {
                                        "DG" : 2,
                                        "Arr" : 0,
                                        "Row" : 0,
                                        "EID:Slot" : "252:3",
                                        "DID" : 11,
                                        "Type" : "DRIVE",
                                        "State" : "Onln",
                                        "BT" : "N",
                                        "Size" : "3.637 TB",
                                        "PDC" : "dflt",
                                        "PI" : "N",
                                        "SED" : "N",
                                        "DS3" : "none",
                                        "FSpace" : "-",
                                        "TR" : "N"
                                },
                                {
                                        "DG" : 3,
                                        "Arr" : "-",
                                        "Row" : "-",
                                        "EID:Slot" : "-",
                                        "DID" : "-",
                                        "Type" : "RAID0",
                                        "State" : "Optl",
                                        "BT" : "N",
                                        "Size" : "3.637 TB",
                                        "PDC" : "dflt",
                                        "PI" : "N",
                                        "SED" : "N",
                                        "DS3" : "none",
                                        "FSpace" : "N",
                                        "TR" : "N"
                                },
                                {
                                        "DG" : 3,
                                        "Arr" : 0,
                                        "Row" : "-",
                                        "EID:Slot" : "-",
                                        "DID" : "-",
                                        "Type" : "RAID0",
                                        "State" : "Optl",
                                        "BT" : "N",
                                        "Size" : "3.637 TB",
                                        "PDC" : "dflt",
                                        "PI" : "N",
                                        "SED" : "N",
                                        "DS3" : "none",
                                        "FSpace" : "N",
                                        "TR" : "N"
                                },
                                {
                                        "DG" : 3,
                                        "Arr" : 0,
                                        "Row" : 0,
                                        "EID:Slot" : "252:4",
                                        "DID" : 13,
                                        "Type" : "DRIVE",
                                        "State" : "Onln",
                                        "BT" : "N",
                                        "Size" : "3.637 TB",
                                        "PDC" : "dflt",
                                        "PI" : "N",
                                        "SED" : "N",
                                        "DS3" : "none",
                                        "FSpace" : "-",
                                        "TR" : "N"
                                },
                                {
                                        "DG" : 4,
                                        "Arr" : "-",
                                        "Row" : "-",
                                        "EID:Slot" : "-",
                                        "DID" : "-",
                                        "Type" : "RAID0",
                                        "State" : "Optl",
                                        "BT" : "N",
                                        "Size" : "3.637 TB",
                                        "PDC" : "dflt",
                                        "PI" : "N",
                                        "SED" : "N",
                                        "DS3" : "none",
                                        "FSpace" : "N",
                                        "TR" : "N"
                                },
                                {
                                        "DG" : 4,
                                        "Arr" : 0,
                                        "Row" : "-",
                                        "EID:Slot" : "-",
                                        "DID" : "-",
                                        "Type" : "RAID0",
                                        "State" : "Optl",
                                        "BT" : "N",
                                        "Size" : "3.637 TB",
                                        "PDC" : "dflt",
                                        "PI" : "N",
                                        "SED" : "N",
                                        "DS3" : "none",
                                        "FSpace" : "N",
                                        "TR" : "N"
                                },
                                {
                                        "DG" : 4,
                                        "Arr" : 0,
                                        "Row" : 0,
                                        "EID:Slot" : "252:5",
                                        "DID" : 14,
                                        "Type" : "DRIVE",
                                        "State" : "Onln",
                                        "BT" : "N",
                                        "Size" : "3.637 TB",
                                        "PDC" : "dflt",
                                        "PI" : "N",
                                        "SED" : "N",
                                        "DS3" : "none",
                                        "FSpace" : "-",
                                        "TR" : "N"
                                },
                                {
                                        "DG" : 5,
                                        "Arr" : "-",
                                        "Row" : "-",
                                        "EID:Slot" : "-",
                                        "DID" : "-",
                                        "Type" : "RAID0",
                                        "State" : "Optl",
                                        "BT" : "N",
                                        "Size" : "3.637 TB",
                                        "PDC" : "dflt",
                                        "PI" : "N",
                                        "SED" : "N",
                                        "DS3" : "none",
                                        "FSpace" : "N",
                                        "TR" : "N"
                                },
                                {
                                        "DG" : 5,
                                        "Arr" : 0,
                                        "Row" : "-",
                                        "EID:Slot" : "-",
                                        "DID" : "-",
                                        "Type" : "RAID0",
                                        "State" : "Optl",
                                        "BT" : "N",
                                        "Size" : "3.637 TB",
                                        "PDC" : "dflt",
                                        "PI" : "N",
                                        "SED" : "N",
                                        "DS3" : "none",
                                        "FSpace" : "N",
                                        "TR" : "N"
                                },
                                {
                                        "DG" : 5,
                                        "Arr" : 0,
                                        "Row" : 0,
                                        "EID:Slot" : "252:6",
                                        "DID" : 15,
                                        "Type" : "DRIVE",
                                        "State" : "Onln",
                                        "BT" : "N",
                                        "Size" : "3.637 TB",
                                        "PDC" : "dflt",
                                        "PI" : "N",
                                        "SED" : "N",
                                        "DS3" : "none",
                                        "FSpace" : "-",
                                        "TR" : "N"
                                }
                        ],
                        "Virtual Drives" : 6,
                        "VD LIST" : [
                                {
                                        "DG/VD" : "0/0",
                                        "TYPE" : "RAID1",
                                        "State" : "Optl",
                                        "Access" : "RW",
                                        "Consist" : "Yes",
                                        "Cache" : "RWTD",
                                        "Cac" : "-",
                                        "sCC" : "ON",
                                        "Size" : "465.25 GB",
                                        "Name" : ""
                                },
                                {
                                        "DG/VD" : "1/1",
                                        "TYPE" : "RAID0",
                                        "State" : "Optl",
                                        "Access" : "RW",
                                        "Consist" : "Yes",
                                        "Cache" : "RWTD",
                                        "Cac" : "-",
                                        "sCC" : "ON",
                                        "Size" : "3.637 TB",
                                        "Name" : ""
                                },
                                {
                                        "DG/VD" : "2/2",
                                        "TYPE" : "RAID0",
                                        "State" : "Optl",
                                        "Access" : "RW",
                                        "Consist" : "Yes",
                                        "Cache" : "RWTD",
                                        "Cac" : "-",
                                        "sCC" : "ON",
                                        "Size" : "3.637 TB",
                                        "Name" : ""
                                },
                                {
                                        "DG/VD" : "3/3",
                                        "TYPE" : "RAID0",
                                        "State" : "Optl",
                                        "Access" : "RW",
                                        "Consist" : "Yes",
                                        "Cache" : "RWTD",
                                        "Cac" : "-",
                                        "sCC" : "ON",
                                        "Size" : "3.637 TB",
                                        "Name" : ""
                                },
                                {
                                        "DG/VD" : "4/4",
                                        "TYPE" : "RAID0",
                                        "State" : "Optl",
                                        "Access" : "RW",
                                        "Consist" : "Yes",
                                        "Cache" : "RWTD",
                                        "Cac" : "-",
                                        "sCC" : "ON",
                                        "Size" : "3.637 TB",
                                        "Name" : ""
                                },
                                {
                                        "DG/VD" : "5/5",
                                        "TYPE" : "RAID0",
                                        "State" : "Optl",
                                        "Access" : "RW",
                                        "Consist" : "Yes",
                                        "Cache" : "RWTD",
                                        "Cac" : "-",
                                        "sCC" : "ON",
                                        "Size" : "3.637 TB",
                                        "Name" : ""
                                }
                        ],
                        "Physical Drives" : 7,
                        "PD LIST" : [
                                {
                                        "EID:Slt" : "252:0",
                                        "DID" : 9,
                                        "State" : "Onln",
                                        "DG" : 0,
                                        "Size" : "465.25 GB",
                                        "Intf" : "SATA",
                                        "Med" : "HDD",
                                        "SED" : "N",
                                        "PI" : "N",
                                        "SeSz" : "512B",
                                        "Model" : "ST500DM002-1BD142",
                                        "Sp" : "U",
                                        "Type" : "-"
                                },
                                {
                                        "EID:Slt" : "252:1",
                                        "DID" : 8,
                                        "State" : "Onln",
                                        "DG" : 0,
                                        "Size" : "465.25 GB",
                                        "Intf" : "SATA",
                                        "Med" : "HDD",
                                        "SED" : "N",
                                        "PI" : "N",
                                        "SeSz" : "512B",
                                        "Model" : "ST500DM002-1BD142",
                                        "Sp" : "U",
                                        "Type" : "-"
                                },
                                {
                                        "EID:Slt" : "252:2",
                                        "DID" : 10,
                                        "State" : "Onln",
                                        "DG" : 1,
                                        "Size" : "3.637 TB",
                                        "Intf" : "SATA",
                                        "Med" : "HDD",
                                        "SED" : "N",
                                        "PI" : "N",
                                        "SeSz" : "512B",
                                        "Model" : "ST4000NM0033-9ZM170",
                                        "Sp" : "U",
                                        "Type" : "-"
                                },
                                {
                                        "EID:Slt" : "252:3",
                                        "DID" : 11,
                                        "State" : "Onln",
                                        "DG" : 2,
                                        "Size" : "3.637 TB",
                                        "Intf" : "SATA",
                                        "Med" : "HDD",
                                        "SED" : "N",
                                        "PI" : "N",
                                        "SeSz" : "512B",
                                        "Model" : "ST4000NM0033-9ZM170",
                                        "Sp" : "U",
                                        "Type" : "-"
                                },
                                {
                                        "EID:Slt" : "252:4",
                                        "DID" : 13,
                                        "State" : "Onln",
                                        "DG" : 3,
                                        "Size" : "3.637 TB",
                                        "Intf" : "SATA",
                                        "Med" : "HDD",
                                        "SED" : "N",
                                        "PI" : "N",
                                        "SeSz" : "512B",
                                        "Model" : "ST4000NM0033-9ZM170",
                                        "Sp" : "U",
                                        "Type" : "-"
                                },
                                {
                                        "EID:Slt" : "252:5",
                                        "DID" : 14,
                                        "State" : "Onln",
                                        "DG" : 4,
                                        "Size" : "3.637 TB",
                                        "Intf" : "SATA",
                                        "Med" : "HDD",
                                        "SED" : "N",
                                        "PI" : "N",
                                        "SeSz" : "512B",
                                        "Model" : "ST4000NM0033-9ZM170",
                                        "Sp" : "U",
                                        "Type" : "-"
                                },
                                {
                                        "EID:Slt" : "252:6",
                                        "DID" : 15,
                                        "State" : "Onln",
                                        "DG" : 5,
                                        "Size" : "3.637 TB",
                                        "Intf" : "SATA",
                                        "Med" : "HDD",
                                        "SED" : "N",
                                        "PI" : "N",
                                        "SeSz" : "512B",
                                        "Model" : "ST4000NM0033-9ZM170",
                                        "Sp" : "U",
                                        "Type" : "-"
                                }
                        ]
                }
        }
        ]
        }
    

    Output

    --- Status ---------------------------------------------
    Controller   0
    Status       Success
    Description  None
    --- Product --------------------------------------------
    Product Name       LSI MegaRAID SAS 9260-8i
    Serial Number      SV30408696
    System Time        11/02/2020 01:15:01
    Controller Time    11/02/2020 08:03:07
    Mfg. Date          01/23/13
    FW Package Build   12.15.0-0239
    FW Version         2.130.403-4660
    BIOS Version       3.30.02.2_4.16.08.00_0x06060A05
    Driver Name        megaraid_sas
    Driver Version     07.703.05.00-rc1
    Host Interface     PCI-E
    Device Interface   SAS-6G
    --- Virtual ------------------------------------------------------------
    DG/VD   TYPE    State   Access  Size    Name
    0/0     RAID1   Optl    RW      465.25 GB
    1/1     RAID0   Optl    RW      3.637 TB
    2/2     RAID0   Optl    RW      3.637 TB
    3/3     RAID0   Optl    RW      3.637 TB
    4/4     RAID0   Optl    RW      3.637 TB
    5/5     RAID0   Optl    RW      3.637 TB
    --- Physical ------------------------------------------------------------
    DG      DID     State   Med     Intf    Size    Model
    0       9       Onln    HDD     SATA    465.25 GB       ST500DM002-1BD142
    0       8       Onln    HDD     SATA    465.25 GB       ST500DM002-1BD142
    1       10      Onln    HDD     SATA    3.637 TB        ST4000NM0033-9ZM170
    2       11      Onln    HDD     SATA    3.637 TB        ST4000NM0033-9ZM170
    3       13      Onln    HDD     SATA    3.637 TB        ST4000NM0033-9ZM170
    4       14      Onln    HDD     SATA    3.637 TB        ST4000NM0033-9ZM170
    5       15      Onln    HDD     SATA    3.637 TB        ST4000NM0033-9ZM170