code: private static String toJSON(Object data) {
          try {
              return mapper.writeValueAsString(data);
          } catch (Exception e) {
              throw new RuntimeException(e);
          }
      }
docs: Writes the data object as a JSON string.
  @param data