code: private void writeObject(Class<?> declaredType, Object obj, SerIterator parentIterator) throws IOException {
          if (obj == null) {
              output.writeNull();
          } else if (settings.getConverter().isConvertible(obj.getClass())) {
              writeSimple(declaredType, obj);
          } else if (obj instanceof Bean) {
              writeBean((Bean) obj, declaredType);
          } else if (parentIterator != null) {
              SerIterator childIterator = settings.getIteratorFactory().createChild(obj, parentIterator);
              if (childIterator != null) {
                  writeElements(childIterator);
              } else {
                  writeSimple(declaredType, obj);
              }
          } else {
              writeSimple(declaredType, obj);
          }
      }
docs: write collection object