code: private static void convertElement(JsonGenerator generator, Element element, boolean isArrayItem, ElementNameConverter converter) throws IOException {
          TYPE type = toTYPE(element.getAttribute("type"));
          String name = element.getTagName();
  
          if (!isArrayItem) {
              generator.writeFieldName(converter.convertName(name));
          }
  
          switch (type) {
              case OBJECT:
                  generator.writeStartObject();
                  convertChildren(generator, element, false, converter);
                  generator.writeEndObject();
                  break;
              case ARRAY:
                  generator.writeStartArray();
                  convertChildren(generator, element, true, converter);
                  generator.writeEndArray();
                  break;
              case STRING:
                  generator.writeString(element.getTextContent());
                  break;
              case INT:
              case FLOAT:
                  generator.writeNumber(new BigDecimal(element.getTextContent()));
                  break;
              case BOOLEAN:
                  generator.writeBoolean(Boolean.parseBoolean(element.getTextContent()));
                  break;
              case NULL:
                  generator.writeNull();
                  break;
          }
      }
docs: Convert a DOM element to Json, with special handling for arrays since arrays don't exist in XML.
  @param generator
  @param element
  @param isArrayItem
  @throws IOException