I am using GSON to parse a JSON file and i want to map this JSON object to a POJO class. The problem is the property name in JSON doesn't have camel-case but my java POJO object having camel-case property name.
Is there any idea without having any performance hit?
Eg: attribute name in JSON file is 'OrderNumber', But in my POJO class , Instead ordernumber, i have 'salesNumber' as attribute name. Now how can we map that OrderNumber from JSON to salesNumber of POJO class?
Thanks in advance!
You can use @SerializedName annotation in this case.
private class SomeObject {
@SerializedName("OrderNumber")
private String salesNumber;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With