Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to data-bind when using java-library to bind json to java-object with "case" difference in json field and class fields #272

Open
scso opened this issue Jun 17, 2020 · 0 comments

Comments

@scso
Copy link

scso commented Jun 17, 2020

When mapping my JSON below
"{ \"ApprovalStatus\": 3, \"ApproverName\": \"Hi\" }"

to my java object defined as below

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
import lombok.Getter;
import lombok.Setter;

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
    "ApprovalStatus",
    "ApproverName"
})
@Getter
@Setter
public class ItineraryJsonIter {
    @JsonProperty ("ApprovalStatus")
    public Long approvalStatus;
    @JsonProperty ("ApproverName")
    public String approverName;
}

However because of the case difference in JSON and class-member it does not get mapped properly, any idea what needs to be done here?
I am using following in my build dependencies

    //JSON-ITER Based Parsing
    compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.11.0'
    // Required if generating JSR-303 annotations
    compile 'javax.validation:validation-api:1.1.0.CR2'
    // Required if generating Jackson 2 annotations
    compile 'com.fasterxml.jackson.core:jackson-databind:2.11.0'
    // Required if generating JodaTime data types
    compile 'joda-time:joda-time:2.2'
    compile group: 'com.jsoniter', name: 'jsoniter', version: '0.9.23'
    //End JSON-ITER Based Parsing

@scso scso changed the title Using java-library to bind json to java-object with "case" differenec Unable to data-bind when using java-library to bind json to java-object with "case" difference in json field and class fields Jun 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant