Loop through nested struct in SV

Hi, I have a struct defined as a member of another struct, but somehow I cannot read the correct member of each struct as expected. The code is as:

typedef struct {
    string       gender;  
    logic [ 4:0] start;    
    logic [ 4:0] ends;    
    int          age;   
} studentInfoT;

typedef struct {
  string         className;   
  logic [32-1:0] classLocation;   
  int            classStudent;   
  studentInfoT   memberInfo[string];
} classInfoT;

module test;

  classInfoT classes[3] = '{

                    '{"A1", 32'h0000_0004, 32,  '{
                                                   "PETER"    : '{"Male   "  ,   0,  31,  12},
                                                   "ANNE"     : '{"Female "  ,   0,   0,  13}
                                                   }}
                ,   '{"A2", 32'h0000_0002, 31,  '{
                                                   "AMANDA"   : '{"Female "  ,   0,   0,  14},
                                                   "DAVID"    : '{"Male   "  ,  31,  31,  12}
                                                   }}
                ,   '{"B1", 32'h0000_0001, 45,  '{
                                                   "TOM"      : '{"Male   "  ,   0,   0,  13},
                                                   "BROWNY"   : '{"Female "  ,  31,  31,  14}
                                                  }}                                                               
};

  initial begin
    foreach (classes[i]) begin
      $display("Class %0s -- %p", classes[i].className, classes[i]);
      $display("--------------------------------------------------");
      foreach (classes[i].memberInfo[s]) begin
        $display("Student name: %0s --> %p", s, classes[i].memberInfo[s]);
      end
      $display("----------------------------------------------------------------------------------------------------\n");
    end
  end

endmodule: test

Here I got this error, I expect to display ANNE and PETER for first class, AMANDA and DAVID for 2nd class only, and TOM and BROWNY for 3rd class but thing they didn’t display as expected, is it relared to the SV printing format or something?? Thank you for any support

Class A1 – ‘{className:“A1”, classLocation:‘h4, classStudent:32, memberInfo:’{“ANNE”:’{gender:"Female ", start:'h0, ends:‘h0, age:13}, “PETER”:’{gender:"Male ", start:'h0, ends:'h1f, age:12}} }
--------------------------------------------------
Student name: ANNE → '{gender:"Female ", start:'h0, ends:'h0, age:13}
Student name: PETER → '{gender:"Male ", start:'h0, ends:'h1f, age:12}
----------------------------------------------------------------------------------------------------

Class A2 – ‘{className:“A2”, classLocation:‘h2, classStudent:31, memberInfo:’{“AMANDA”:’{gender:"Female ", start:'h0, ends:‘h0, age:14}, “DAVID”:’{gender:"Male ", start:'h1f, ends:'h1f, age:12}} }
--------------------------------------------------
Student name: ANNE → '{gender:“”, start:'hxx, ends:'hxx, age:0}
Student name: DAVID → '{gender:"Male ", start:'h1f, ends:'h1f, age:12}
----------------------------------------------------------------------------------------------------

Class B1 – ‘{className:“B1”, classLocation:‘h1, classStudent:45, memberInfo:’{“BROWNY”:’{gender:"Female ", start:'h1f, ends:‘h1f, age:14}, “TOM”:’{gender:"Male ", start:'h0, ends:'h0, age:13}} }
--------------------------------------------------
Student name: AMANDA → '{gender:“”, start:'hxx, ends:'hxx, age:0}
Student name: BROWNY → '{gender:"Female ", start:'h1f, ends:'h1f, age:14}
Student name: TOM → '{gender:"Male ", start:'h0, ends:'h0, age:13}
----------------------------------------------------------------------------------------------------

On EDA Playground, your code works as expected on 3 of the 4 simulators. One simulator seems to give incorrect results, which is likely a tool issue.