on 2019 Aug 27 8:08 AM
Hi,
I have created one controller in version 2 which will take JSON as request.
@RequestMapping(value = "/trackStatus", method = RequestMethod.POST, consumes = "application/json")
@ResponseStatus(value = HttpStatus.OK)
public @ResponseBody ConsignmentTrackData updateConsignment(@RequestBody(required=false) ConsignmentTrackData json) {
In JSON I have key like "tracking_number" and in POJO I have variable "trackingNumber" for it.
Tried:
import com.google.gson.annotations.SerializedName;
@SerializedName("tracking_number")
private String trackingNumber;
as well as
import com.fasterxml.jackson.annotation.JsonProperty;
@JsonProperty("tracking_number")
private String trackingNumber;
I have tried this in my separate java program and used it in other DTOs also within Hybris but here in this controller it does not seems to be working.
json.getTrackingNumber() gives me null. Value is not getting populated in it.
Thank you.
Request clarification before answering.
You have to map your attributes of dto with POJO in dto-mappings-v2-springs.xml.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.