0

I have an API REST service, developed using JAX-RS. I need to make its request accept snake case as it currently only receives camel case.

NOTE: I'm using the @Json_ignore property but it doesn't work

Controller

@POST
@Consumes("application/json")
public Response listarAcuerdos(ListarAcuerdosRequestType request) throws Exception {
    ...
    return Response.ok().entity(result).build();
}

Request Bean

@XmlRootElement
public class ListarAcuerdosRequestType {

    @JsonProperty("codigo_matv")
    private String codigoMatv;

    public String getCodigoMatv() {
        return codigoMatv;
    }

    public void setCodigoMatv(String codigoMatv) {
        this.codigoMatv = codigoMatv;
    }
}
  • check this one https://stackoverflow.com/a/53206523/7237884 – Panagiotis Bougioukos Mar 24 '21 at 20:17
  • If you are using jackson, you can change the naming strategy to SNAKE_CASE - https://fasterxml.github.io/jackson-databind/javadoc/2.7/com/fasterxml/jackson/databind/PropertyNamingStrategy.SnakeCaseStrategy.html – aksappy Mar 24 '21 at 20:25

0 Answers0