ralfstx / minimal-json

A fast and small JSON parser and writer for Java
MIT License
732 stars 186 forks source link

Feature request: Json.value for object wrappers of primitive types (null support) #90

Open Aison0 opened 6 years ago

Aison0 commented 6 years ago

Is it possible it add versions of Json.value that take the wrapped type of supported primitive types? See example below

  public static JsonValue value(boolean value) {
    return value ? TRUE : FALSE;
  }

  public static JsonValue value(Boolean value) {
    return value != null? value ? TRUE : FALSE : NULL;
  }
bernardosulzbach commented 6 years ago

I'm not against the idea, but maybe this does not belong to minimal JSON.

As you have shown, your own minimal-json wrapper code can quite easily have a single line method that does exactly this.