1

This is a method in my spring Controller

@RequestMapping(value = AccountLvlConfigURI.GET_CONFIG_AGENCY, method = RequestMethod.POST)
public 
@ResponseBody AccLvlConfigRes getAccountLevelConfigByAgency() throws BusinessException {
    return accountLevelConfigBo.getAccountLevelConfigByAgency();
}

And here is my AccLvlConfigRes class:

public class AccLvlConfigRes implements Serializable {
    private static final long serialVersionUID = -2066756616998244103L;

    private Integer levelNumber;
    private Integer minPoint;
    private BigDecimal percentBuyTicketInter;

    public AccLvlConfigRes(){}

    // Getters - Setters

}

The problem is the client can get values of levelNumber, minPoint, however, can't get value of percentBuyTicketInter (5 scale, 2 precision).

How can I transmit the BigDecimal variable type to client in Spring Restful

Leo Le
  • 815
  • 3
  • 13
  • 33
  • 2
    possible duplicate of [Java to Jackson JSON serialization: Money fields](http://stackoverflow.com/questions/11319445/java-to-jackson-json-serialization-money-fields) – Robert Moskal Sep 16 '15 at 03:05
  • Follow the link, I think it will get you where you want to go. You need to write a custom serializer. – Robert Moskal Sep 16 '15 at 03:05

1 Answers1

0

I had a similar issue. solution i did was to to declare percentBuyTicketInter as a string and in the setter covert it to bigdecimal. It worked for us.

Albert Pinto
  • 392
  • 2
  • 6
  • 17