docs: @Nullable
      public String toJson(@Nullable Map<String, Object> map) {
          if (map == null || map.isEmpty()) {
              return null;
          }
  
          try (StringWriter writer = new StringWriter(bufferSize)) {
              objectMapper.writeValue(writer, map);
              if (doesAppendLineSeparator) {
                  writer.append(CoreConstants.LINE_SEPARATOR);
              }
              return writer.toString();
          } catch (IOException e) {
              throw new IllegalArgumentException("Unable to format map as a JSON", e);
          }
      }