Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9143179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:57:33+00:00 2026-06-17T09:57:33+00:00

We use JSON serialization with Jackson to expose internal state of the system for

  • 0

We use JSON serialization with Jackson to expose internal state of the system for debugging properties.

By default jackson does not serialize transient fields – but I wish to serialize them as well.
How can I serialize these fields?

One way I know is to supply a getters for these fields – but I don’t want to do that, as I have some getX methods that I don’t want to be invoked ( for instance, there are some getters that change the objects state ).

I know I could create an annotation, but I really want to avoid it.

So my question is:
Is there a way to setup jackson to serialize all the objects fields? include transient ones.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:57:34+00:00Added an answer on June 17, 2026 at 9:57 am

    I don’t think Jackson supports any type of configuration to enable it to serialize a transient field. There’s an open issue to add that feature, but it’s old and hasn’t been addressed (as far as I can tell): http://jira.codehaus.org/browse/JACKSON-623

    So my question is: Is there a way to setup jackson to serialize all
    the objects fields? include transient ones.

    So to answer your question, no.

    Some other Java JSON tools, such as GSON do support a configuration option to serialize transient fields. If you can use another tool, you might look into that (for GSON, see: https://sites.google.com/site/gson/gson-user-guide).

    To expand a little, you might try a different approach.

    First, You shouldn’t try to serialize a transient field. After all the definition of transient is “don’t serialize this.” Nevertheless I can think of a few specific situations where it might be necessary, or at least convenient (like when working with code you can’t modify or such). Still, in 99% of cases, the answer is don’t do that. Change the field so that it’s not transient if you need to serialize it. If you have multiple contexts where you use the same field, and you want it serialized in one (JSON, for example), and not serialized in another (java.io, for example) then you should create a custom serializer for the case where you don’t want it, rather than abuse the keyword.

    Second, as to using a getter and having “some getters that change the objects state,” you should try to avoid that too. That can lead to various unintended consequences. And, technically, that’s not a getter, that’s a setter. What I mean is, if it mutates state, you’ve got a mutator (setter) rather than accessor (getter), even if you name it following the “get” convention and return some stuff.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd prefer to use Microsofts System.Runtime.Serialization.Json.DataContractJsonSerializer to serialize my objects in JSON so I
I use stock JSON serialiser in .NET 4.5 windows store app - System.Runtime.Serialization.Json.DataContractJsonSerializer I
If i try to serialize an object of the following ClassToSerialize class with System.Runtime.Serialization.Json.DataContractJsonSerializer
I use Jackson library for serialization of my pojo objects into JSON representation. For
I'm trying to use Json.NET to serialize and deserialze a tree structure for jsTree.
Normally for REST APIs I'd use JSON as the output serialization format, but I'm
I am trying to use Json.NET to serialize a subclass. The resulting json contains
I'm trying to use ServiceStack for Json serialization/deserialization in MonoDroid project. I've built ServiceStack
I have a project that use JSON as cross-language serialization to pass around data.
I use json data with jquery... I have filepaths in json and i am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.