code: @Override
      public String serialize(T element) {
          String json = null;
          try {
              json = element.toJSON();
          } catch (Exception e) {
              log.error("Direct serialization failed, falling back to jackson");
          }
  
          if (json == null || json.isEmpty()) {
              ObjectMapper mapper = SequenceElement.mapper();
              try {
                  json = mapper.writeValueAsString(element);
              } catch (org.nd4j.shade.jackson.core.JsonProcessingException e) {
                  throw new RuntimeException(e);
              }
          }
  
          return json;
      }
docs: This method serializaes object  into JSON string
  
  @param element
  @return