Annotation Type JsonProperty


@Target({ANNOTATION_TYPE,FIELD,METHOD,PARAMETER}) @Retention(RUNTIME) public @interface JsonProperty
  • Element Details

    • value

      String value
      Returns:
      alternative name for the field/getter/setter/parameter
      Default:
      ""
    • from

      String[] from
      Returns:
      when bind from multiple possible names, set this
      Default:
      {}
    • to

      String[] to
      Returns:
      when one field will write to multiple object fields, set this
      Default:
      {}
    • required

      boolean required
      Returns:
      used in decoding only, the field must present in the JSON, regardless null or not
      Default:
      false
    • decoder

      Class<? extends Decoder> decoder
      Returns:
      set different decoder just for this field
      Default:
      com.jsoniter.spi.Decoder.class
    • implementation

      Class<?> implementation
      Returns:
      used in decoding only, choose concrete class for interface/abstract type
      Default:
      java.lang.Object.class
    • encoder

      Class<? extends Encoder> encoder
      Returns:
      set different encoder just for this field
      Default:
      com.jsoniter.spi.Encoder.class
    • nullable

      boolean nullable
      Returns:
      used in encoding only, should check null for this field, skip null checking will make encoding faster
      Default:
      true
    • collectionValueNullable

      boolean collectionValueNullable
      Returns:
      used in encoding only, should check null for the value, if it is collection, skip null checking will make encoding faster
      Default:
      true
    • defaultValueToOmit

      String defaultValueToOmit
      Returns:
      the default value to omit null, to omit null value \"xxx\", to omit string value 123, to omit number void, to always encode this field, ignore global config
      Default:
      ""