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 6031433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:11:00+00:00 2026-05-23T05:11:00+00:00

I am attempting to deserialize a JSON object stored in CouchDb using Jackson. This

  • 0

I am attempting to deserialize a JSON object stored in CouchDb using Jackson. This object needs to deserialize into a pojo that contains overloaded methods. When I attempt to retrieve the object from couch and do the deserialization I get the following exception:

org.ektorp.DbAccessException:
org.codehaus.jackson.map.JsonMappingException:
Conflicting setter definitions for
property “multiplier”:
com.db.commodities.framework.sdos.model.security.EqOpt#setMultiplier(1
params) vs
com.db.commodities.framework.sdos.model.security.EqOpt#setMultiplier(1
params)

I tried to annotate the setter I would like Jackson to use, but that appears to not have worked.

@JsonProperty("multiplier")
public void setMultiplier(SDOSAttribute multiplier) {
     this.multiplier = multiplier;
}

public void setMultiplier(double multiplier) {
     this.multiplier.setValue(String.valueOf(multiplier));
}

How do I configure Jackson to properly deserialize using a specific method? Or am I approaching this problem the wrong way?

EDIT:

I have made the following changes. This seems to work, but is a little uglier. If anyone has a better way to do this please feel free to share and I will gladly accept.

@JsonProperty("multiplier")
protected void setMultiplierAttribute(SDOSAttribute multiplier) {
    this.multiplier = multiplier;
}

@JsonIgnore
public void setMultiplier(double multiplier) {
    this.multiplier.setValue(String.valueOf(multiplier));
}
  • 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-05-23T05:11:00+00:00Added an answer on May 23, 2026 at 5:11 am

    It’s not necessary to change the name of the setter method to avoid ambiguity. You’re otherwise on the right track with @JsonIgnore. With @JsonIgnore on all of the same-named methods to be ignored, the one to use does not need the @JsonProperty annotation.

    Here’s a simple example to demonstrate this point.

    input.json: {"value":"forty-two"}

    Foo.java:

    import java.io.File;
    
    import org.codehaus.jackson.annotate.JsonIgnore;
    import org.codehaus.jackson.map.ObjectMapper;
    
    public class Foo
    {
      String value;
    
      public String getValue() {return value;}
      public void setValue(String value) {this.value = value;}
    
      @JsonIgnore
      public void setValue(int value) {this.value = String.valueOf(value);}
    
      public static void main(String[] args) throws Exception
      {
        ObjectMapper mapper = new ObjectMapper();
        Foo foo = mapper.readValue(new File("input.json"), Foo.class);
        System.out.println(mapper.writeValueAsString(foo));
      }
    }
    

    If you don’t want to alter the pristine POJO defs with a Jackson annotation, then you can use a MixIn.

    import java.io.File;
    
    import org.codehaus.jackson.annotate.JsonIgnore;
    import org.codehaus.jackson.map.ObjectMapper;
    
    public class Foo
    {
      String value;
    
      public String getValue() {return value;}
      public void setValue(String value) {this.value = value;}
      public void setValue(int value) {this.value = String.valueOf(value);}
    
      public static void main(String[] args) throws Exception
      {
        ObjectMapper mapper = new ObjectMapper();
        mapper.getDeserializationConfig().addMixInAnnotations(Foo.class, IgnoreFooSetValueIntMixIn.class);
        Foo foo = mapper.readValue(new File("input.json"), Foo.class);
        System.out.println(mapper.writeValueAsString(foo));
      }
    }
    
    abstract class IgnoreFooSetValueIntMixIn
    {
      @JsonIgnore public abstract void setValue(int value);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Attempting to deserialize JSON data and update each object's prototype and inherit a common
Attempting to render a model object into a JSON structure via a partial, like
the server throws this error Attempting to deserialize an empty stream at server side
I'm trying to build an object that looks something like this: public class MyObject
I have some JSON data that looks like this: { data: [{ name:John Smith,
I am sometimes receiving the following exception when attempting to deserialise an object using
I'm attempting to deserialize a custom class via the XmlSerializer and having a few
Attempting to insert an escape character into a table results in a warning. For
Attempting to print out a list of values from 2 different variables that are
Attempting to use the data series from this example no longer passes the JSONLint

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.