Skip to content

JSON Attributes

Overrides the generated JSON property name for a field.

model UserInfo {
[JsonPropertyName("user_id")]
Id: string;
}

This attribute is field-local.

Applies a naming strategy to generated JSON field names for a model or scope.

#[JsonPropertyNamingStrategy("snake_case")]

Supported strategy names are:

  • PascalCase
  • camelCase
  • snake_case
  • kebab-case

JsonPropertyName on a field takes precedence over the naming strategy.