我怎样才能得到数组值的 PL/JSON 数组

How can I get PL/JSON array of array value

如何使用 Pl/JSON 从 JSON 下方检索内容? 我需要获取第一个数组和第二个数组的值

 {
  "documents1": [
    { 
      "key": "NATID",
      "validations": [
        {
          "error": "Field is required"
        }
      ]
    }
  ]
} 

例如,我编写了如下查询,第一个数组的 returns 值没有任何问题,但它没有 return 数组数组的值

DECLARE
   obj                     json
      := json
           ('{
  "documents1": [
    { 
      "key": "NATID",
      "validations": [
        {
          "error": "Field is required"
        }
      ]
    }
  ]
}'
           );
   list_value              json_list;
   list_value_validation   json_list;
   LIST_VALUES             json_list;
BEGIN
   list_value := json_list (obj.get ('documents'));

   FOR i IN 1 .. list_value.COUNT
   LOOP
      DBMS_OUTPUT.put_line (   'key->'
                            || json_ext.get_string (json (list_value.get (i)),
                                                    'key'
                                                   )
                           );
      ----------below scripts are not working
      list_value_validation := json_list (list_value.get ('values'));

      FOR iv IN 1 .. list_value_validation.COUNT
      LOOP
         DBMS_OUTPUT.put_line
                    (   'error->'
                     || json_ext.get_string
                                          (json (list_value_validation.get (iv)
                                                ),
                                           'error'
                                          )
                    );
      END LOOP;
   END LOOP;
END;

修改代码如下,运行正常。

BEGIN
   list_value := json_list (obj.get ('documents'));

   FOR i IN 1 .. list_value.COUNT
   LOOP
         p_string_docs := list_value.get (i).TO_CHAR ();

         obj_docs := json (p_string_docs);

         l_output := json_ext.get_string (obj_docs, 'key');

         list_docs_validation := json_list (obj_docs.get ('values'));

            FOR i IN 1 .. list_docs_validation.COUNT
            LOOP

            l_output :=
               json_ext.get_string (obj_docs, 'key')|| ' | ' 
            || json_ext.get_string (json (list_docs_validation.get (i)),
                                    'code'
                                   );

               DBMS_OUTPUT.put_line (l_output);                         


            END LOOP;
   END LOOP;
END;