46328

Can Jackson SerializationFeature be overridden per field or class?

Can a (De)SerializationFeature be enabled/disabled per object or per field? I cannot think of a simple way.

To be specific, I have enabled WRITE_SINGLE_ELEM_ARRAYS_UNWRAPPED for the readability of data fields that rarely expand beyond 1 item. However for some top-level structures, I want to always keep the array-ness. Critique that mix as you will but the general question still stands :)

Answer1:

Not in general way.

But for this particular feature, I think there may be an issue filed to allow such handling already at github. If not, feel free to submit one.

The reason there is no general way is that for many features this level of granularity does not make sense.

Recommend

  • Show item of the day
  • Matlab: Fundamental limitations of struct array?
  • Warning when rvalue-declared variable goes out of scope being not moved from
  • Password strong - not require each condition
  • Java tree with columns
  • Ansible syntax best practice, YAML dictionary (key: value) or equal sign (key=value)?
  • add new field to form with rvest
  • Stretch a span across a td
  • Reading .mat file in C++
  • Change Divider Color Android DatePicker Dialog
  • Google Bigquery Command Line Return Limit
  • How to fallback to entirely different index page if user has javascript disable?
  • How to get google-services.json from Developer console?
  • Struct pointer casts
  • How to check disabled jobs with Jenkins server?
  • Can you use DataSet and DataTables in a Portable Class Library
  • How to protect an asp:textbox from user input?
  • conditions for accessors in Coldfusion ORM
  • What is the default HTTP verb in WebApi ? GET or POST?
  • Using Generics on right hand side in Java 6?
  • Installed module is empty
  • how to display data from 1st point on words on y axis for line chart in d3.js
  • How to get Eclipse Oxygen to run on Java 9
  • Rails Find when some params will be blank
  • Change multiple background-images with jQuery
  • Algorithm for a smudge tool?
  • Control modification in presentation layer
  • How can I send an e-mail from a vbs script
  • Sails.js/waterline: Executing waterline queries in toJSON function of a model?
  • Align navbar back button on right side
  • Redux, normalised entities and lodash merge
  • Android Studio and gradle
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • NSLayoutConstraint that would pin a view to the bottom edge of a superview
  • how does django model after text[] in postgresql [duplicate]
  • embed rChart in Markdown
  • How to get NHibernate ISession to cache entity not retrieved by primary key
  • How can I use `wmic` in a Windows PE script?
  • Unable to use reactive element in my shiny app
  • How to push additional view controllers onto NavigationController but keep the TabBar?