code: private JSONArray array2JSON(JSONArray ja, Object[] array) {
          for (int i = 0; i < array.length; i++) {
              // array entry is a Map
              if (array[i] instanceof Map) {
                  //if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                  //    Tr.debug(tc, "array entry is a Map, calling map2JSON", array[i]);
                  //}
                  ja.add(map2JSON(new JSONObject(), (Map<String, Object>) array[i]));
              }
              // array entry is an array
              else if (array[i].getClass().isArray()) {
                  //if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                  //    Tr.debug(tc, "array entry is a array, calling array2JSON", array[i]);
                  //}
                  ja.add(array2JSON(new JSONArray(), (Object[]) array[i]));
              }
              // else array entry is a "simple" value
              else {
                  //if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                  //    Tr.debug(tc, "array entry is a simple value, adding to ja", array[i]);
                  //}
                  ja.add(array[i]);
              }
          }
          return ja;
      }
docs: Given a Java array, add the corresponding JSON to the given JSONArray object
  
  @param ja - JSONArray object
  @param array - Java array object