Jackson Glossary: PropertyNamingStrategy

Role

PropertyNamingStrategy is an abstract class that defines simple way to customize way POJO property names are converted to matching JSON property names. Default implementation simply returns suggested name (which is derived from methods as per Java Bean specification; and for fields is simply field name as-is).

Sub-class of this class can be used in cases where naming convention used in JSON format differs from Bean convention: for example when naming convention is

See JacksonFeaturePropertyNamingStrategy for more information

Usage

Custom implementation are registered with ObjectMapper:

  ObjectMapper mapper = new ObjectMapper();
  mapper.setPropertyNamingStrategy(new MyNamingStrategy());

and take effect for both serialization and deserialization.


Back to Jackson Term Glossary


CategoryJackson

PropertyNamingStrategy (last edited 2011-03-09 07:07:13 by TatuSaloranta)

Copyright ©2009 FasterXML, LLC