code: private Object convertToMaps(TabularData pTd, Stack<String> pExtraArgs, ObjectToJsonConverter pConverter) throws AttributeNotFoundException {
          JSONObject ret = new JSONObject();
          TabularType type = pTd.getTabularType();
          List<String> indexNames = type.getIndexNames();
  
          boolean found = false;
          for (CompositeData cd : (Collection<CompositeData>) pTd.values()) {
              Stack<String> path = (Stack<String>) pExtraArgs.clone();
              try {
                  JSONObject targetJSONObject = ret;
                  // TODO: Check whether all keys can be represented as simple types. If not, well
                  // we dont do any magic and return the tabular data as an array.
                  for (int i = 0; i < indexNames.size() - 1; i++) {
                      Object indexValue = pConverter.extractObject(cd.get(indexNames.get(i)), null, true);
                      targetJSONObject = getNextMap(targetJSONObject, indexValue);
                  }
                  Object row = pConverter.extractObject(cd, path, true);
                  String finalIndex = indexNames.get(indexNames.size() - 1);
                  Object finalIndexValue = pConverter.extractObject(cd.get(finalIndex), null, true);
                  targetJSONObject.put(finalIndexValue, row);
                  found = true;
              } catch (ValueFaultHandler.AttributeFilteredException exp) {
                  // Ignoring filtered attributes
              }
          }
          if (!pTd.isEmpty() && !found) {
              throw new ValueFaultHandler.AttributeFilteredException();
          }
          return ret;
      }
docs: Convert tabular data to (nested) maps. Path access is allowed here