docs: @SuppressWarnings("unchecked")
  	public static Map<String, Object> toNullableMap(Object value) {
  		if (value == null)
  			return null;
  
  		Class<?> valueClass = value.getClass();
  		if (valueClass.isPrimitive())
  			return null;
  
  		if (value instanceof Map<?, ?>)
  			return mapToMap((Map<Object, Object>) value);
  
  		if (valueClass.isArray())
  			return arrayToMap((Object[]) value);
  
  		if (value instanceof Collection<?>)
  			return listToMap((Collection<Object>) value);
  
  		try {
  			return mapper.convertValue(value, typeRef);
  		} catch (Exception ex) {
  			return null;
  		}
  	}