code: public static <T> LinkedMapWritable getLinkedMapWritableFromObject(T t)
              throws IllegalAccessException, InstantiationException, InvocationTargetException {
          Field[] fields = AnnotationUtils.filterDeepFields(t.getClass());
  
          LinkedMapWritable linkedMapWritable = new LinkedMapWritable();
  
          for (Field field : fields) {
              Method method = Utils.findGetter(field.getName(), t.getClass());
              Object object = method.invoke(t);
              if (object != null) {
                  if (Collection.class.isAssignableFrom(field.getType())) {
                      Collection c = (Collection) object;
                      Iterator iterator = c.iterator();
                      List<LinkedMapWritable> innerJsonList = new ArrayList<>();
  
                      while (iterator.hasNext()) {
                          innerJsonList.add(getLinkedMapWritableFromObject((IDeepType) iterator.next()));
                      }
                      // linkedMapWritable.put(new Text(AnnotationUtils.deepFieldName(field)), new
                      // LinkedMapWritable[innerJsonList.size()]);
                  } else if (IDeepType.class.isAssignableFrom(field.getType())) {
                      linkedMapWritable.put(new Text(AnnotationUtils.deepFieldName(field)),
                              getLinkedMapWritableFromObject((IDeepType) object));
                  } else {
                      linkedMapWritable
                              .put(new Text(AnnotationUtils.deepFieldName(field)), getWritableFromObject(object));
                  }
              }
          }
  
          return linkedMapWritable;
      }
docs: converts from an entity class with deep's anotations to JSONObject.
  
  @param t   an instance of an object of type T to convert to JSONObject.
  @param <T> the type of the object to convert.
  @return the provided object converted to JSONObject.
  @throws IllegalAccessException
  @throws InstantiationException
  @throws InvocationTargetException