com.fasterxml.jackson.databind

## Class PropertyNamingStrategy.SnakeCaseStrategy

- java.lang.Object
- - com.fasterxml.jackson.databind.PropertyNamingStrategy
  - - com.fasterxml.jackson.databind.PropertyNamingStrategy.PropertyNamingStrategyBase
    - - com.fasterxml.jackson.databind.PropertyNamingStrategy.SnakeCaseStrategy

- All Implemented Interfaces:
    java.io.Serializable
  Direct Known Subclasses:
    PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy
  Enclosing class:
    PropertyNamingStrategy

      public static class PropertyNamingStrategy.SnakeCaseStrategy
      extends PropertyNamingStrategy.PropertyNamingStrategyBase

  A `PropertyNamingStrategy` that translates typical camel case Java property names to lower case JSON element names, separated by underscores. This implementation is somewhat lenient, in that it provides some additional translations beyond strictly translating from camel case only. In particular, the following translations are applied by this PropertyNamingStrategy.
  - Every upper case letter in the Java property name is translated into two characters, an underscore and the lower case equivalent of the target character, with three exceptions.
    1. For contiguous sequences of upper case letters, characters after the first character are replaced only by their lower case equivalent, and are not preceded by an underscore.
       - This provides for reasonable translations of upper case acronyms, e.g., "theWWW" is translated to "the_www".
    2. An upper case character in the first position of the Java property name is not preceded by an underscore character, and is translated only to its lower case equivalent.
       - For example, "Results" is translated to "results", and not to "_results".
    3. An upper case character in the Java property name that is already preceded by an underscore character is translated only to its lower case equivalent, and is not preceded by an additional underscore.
       - For example, "user_Name" is translated to "user_name", and not to "user__name" (with two underscore characters).
  - If the Java property name starts with an underscore, then that underscore is not included in the translated name, unless the Java property name is just one character in length, i.e., it is the underscore character. This applies only to the first character of the Java property name.
  These rules result in the following additional example translations from Java property names to JSON element names.
  - "userName" is translated to "user_name"
  - "UserName" is translated to "user_name"
  - "USER_NAME" is translated to "user_name"
  - "user_name" is translated to "user_name" (unchanged)
  - "user" is translated to "user" (unchanged)
  - "User" is translated to "user"
  - "USER" is translated to "user"
  - "_user" is translated to "user"
  - "_User" is translated to "user"
  - "__user" is translated to "_user" (the first of two underscores was removed)
  - "user__name" is translated to "user__name" (unchanged, with two underscores)
  Since:
    2.7 (was previously called }
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.PropertyNamingStrategy

      `PropertyNamingStrategy.KebabCaseStrategy, PropertyNamingStrategy.LowerCaseStrategy, PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy, PropertyNamingStrategy.PascalCaseStrategy, PropertyNamingStrategy.PropertyNamingStrategyBase, PropertyNamingStrategy.SnakeCaseStrategy, PropertyNamingStrategy.UpperCamelCaseStrategy`

  - ### Field Summary

    - ### Fields inherited from class com.fasterxml.jackson.databind.PropertyNamingStrategy

      `CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES, KEBAB_CASE, LOWER_CAMEL_CASE, LOWER_CASE, PASCAL_CASE_TO_CAMEL_CASE, SNAKE_CASE, UPPER_CAMEL_CASE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PropertyNamingStrategy.SnakeCaseStrategy()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `translate(java.lang.String input)`

    - ### Methods inherited from class com.fasterxml.jackson.databind.PropertyNamingStrategy.PropertyNamingStrategyBase

      `nameForConstructorParameter, nameForField, nameForGetterMethod, nameForSetterMethod`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PropertyNamingStrategy.SnakeCaseStrategy

          public PropertyNamingStrategy.SnakeCaseStrategy()

  - ### Method Detail

    - #### translate

          public java.lang.String translate(java.lang.String input)

      Specified by:
        `translate` in class `PropertyNamingStrategy.PropertyNamingStrategyBase`