Annotation Type JsonProperty


  • @Target({FIELD,METHOD,PARAMETER})
    @Retention(RUNTIME)
    public @interface JsonProperty
    Marker annotation that can be used to define a non-static method as a "setter" or "getter" for a logical property (depending on its signature), or non-static object field to be used (serialized, deserialized) as a logical property.

    Default value ("") indicates that the field name is used as the property name without any modifications, but it can be specified to non-empty value to specify different name. Property name refers to name used externally, as the field name in Json objects.

    NOTE: since version 1.1, annotation has also been applicable to fields (not with 1.0).

    NOTE: since version 1.2, annotation has also been applicable to (constructor) parameters

    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      String value
      Defines name of the logical property, i.e.
    • Element Detail

      • value

        String value
        Defines name of the logical property, i.e. Json object field name to use for the property: if empty String (which is the default), will use name of the field that is annotated.
        Default:
        ""