alwaysAddJsonValue property

bool alwaysAddJsonValue
final

Is ignored when includeJsonAnnotations is set to false.

When alwaysAddJsonValue is false then @JsonValue will only be added when the JSON node key and generated TypeMember name are not identical.

Example:

Given a JSON node:

"metallica":"awesome"

With alwaysAddJsonValue set to true will return:

@JsonValue("metallica"
final String metallica;

But with alwaysAddJsonValue set to false will return:

final String metallica;

TypeMember name and JSON node key are identical so @JsonValue is not mandatory.

Given a JSON node:

"metallica-awesome":"doh!"

With alwaysAddJsonValue set to false will still return:

@JsonValue("metallica"
final String metallica;

TypeMember name and JSON node key are different so the @JsonValue is added. To disable adding annotations entirely set includeJsonAnnotations to false.

{@category generator}

Implementation

final bool alwaysAddJsonValue;