@@ -104,6 +104,8 @@ package JSON is
104104 function jsonGetBoolean(JSONContext : T_JSON; Path : STRING ) return BOOLEAN ;
105105 function jsonGetString(JSONContext : T_JSON; Path : STRING ) return STRING ;
106106 function jsonGetIntegerArray(JSONContext : T_JSON; Path : string ) return integer_vector ;
107+ function jsonGetIntegerArray(JSONContext : T_JSON; Path : string ; Len : positive ) return integer_vector ;
108+ -- function jsonGetRealArray(JSONContext : T_JSON; Path : string) return real_vector;
107109
108110 function jsonIsBoolean(JSONContext : T_JSON; Path : STRING ) return BOOLEAN ;
109111 function jsonIsNull(JSONContext : T_JSON; Path : STRING ) return BOOLEAN ;
@@ -1486,7 +1488,7 @@ package body JSON is
14861488 end if ; -- Index = 0
14871489 for j in 1 to Index loop
14881490 if (IndexElement.NextIndex = 0 ) then
1489- report " jsonGetElementIndex: Reached last element in chain." severity FAILURE ;
1491+ report " jsonGetElementIndex: Reached last element in chain." severity NOTE ; --FAILURE
14901492 return 0 ;
14911493 end if ;
14921494 IndexElement := JSONContext.Index (IndexElement.NextIndex);
@@ -1622,15 +1624,24 @@ package body JSON is
16221624
16231625 -- function to get a integer_vector from the compressed content extracted from a JSON input
16241626 function jsonGetIntegerArray(JSONContext : T_JSON; Path : string ) return integer_vector is
1625- constant len: positive := to_natural_dec( jsonGetString(JSONContext, Path & " /0" ) );
1626- variable return_value : integer_vector (len- 1 downto 0 );
1627+ variable len: natural := 0 ;
16271628 begin
1628- for i in 1 to len loop
1629- return_value(i - 1 ) := to_natural_dec(jsonGetString(JSONContext, Path & " / " & to_string(i))) ;
1629+ while jsonIsNumber(JSONContext, Path & " / " & to_string( len)) loop
1630+ len := len + 1 ;
16301631 end loop ;
1631- return return_value ;
1632+ return jsonGetIntegerArray(JSONContext, Path, len) ;
16321633 end ;
16331634
1635+ -- function to get a integer_vector of a fixed length from the compressed content extracted from a JSON input
1636+ function jsonGetIntegerArray(JSONContext : T_JSON; Path : string ; Len : positive ) return integer_vector is
1637+ variable return_value : integer_vector (Len- 1 downto 0 );
1638+ begin
1639+ for i in 0 to Len- 1 loop
1640+ return_value(i) := to_natural_dec(jsonGetString(JSONContext, Path & " /" & to_string(i)));
1641+ end loop ;
1642+ return return_value;
1643+ end function ;
1644+
16341645 function jsonIsBoolean(JSONContext : T_JSON; Path : STRING ) return BOOLEAN is
16351646 constant ElementIndex : T_UINT16 := jsonGetElementIndex(JSONContext, Path);
16361647 constant Element : T_JSON_INDEX_ELEMENT := JSONContext.Index (ElementIndex);
0 commit comments