code: static void putDoubleIfNotNull(
              @NonNull JSONObject jsonObject,
              @NonNull @Size(min = 1) String fieldName,
              @Nullable Double value) {
          if (value == null) {
              return;
          }
          try {
              jsonObject.put(fieldName, value.doubleValue());
          } catch (JSONException ignored) { }
      }
docs: Util function for putting a double value into a {@link JSONObject} if that
  value is not null. This ignores any {@link JSONException} that may be thrown
  due to insertion.
  
  @param jsonObject the {@link JSONObject} into which to put the field
  @param fieldName the field name
  @param value the potential field value