jakartaee / jsonb-api

Jakarta JSON Binding
https://eclipse-ee4j.github.io/jsonb-api/
Other
78 stars 39 forks source link

@JsonbProperty on boolean field not resolved correctly #252

Open dft4msg opened 4 years ago

dft4msg commented 4 years ago

I'm migrating from JAX-B (+Jackson Binding) to JSON-B (Yasson) and found a possible issue concerning the processing of the @JsonbProperty(value = "...") in some special cases.

Simplified I have POJOs with the following:

    @JsonbProperty(value = "myBool")
    private boolean isSomething;

    public boolean isSomething() {
        return isSomething;
    }

    public void setSomething(boolean isSomething) {
        this.isSomething = isSomething;
    }

The getter and setter are generated automatically by the IDE or lombok in this way. In this case, the getter is named in the same way as the field (isSomething) as you see.

When I process that with Yasson, I get something like this: {..., "something":true, ...}

But I want it to be {..., "myBool":true, ...}

Bug or Feature?

I attached some test to reproduce it.

SamplePojo.java.txt SamplePojoTest.java.txt pom.xml.txt