cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Additional attribute getting added to Json response

former_member634058
Active Participant
0 Likes
515

Hi All,
When I am trying to post a json response for occ, I am getting an additional attribute "type" getting added to the response.
{
"type": "omsReturnReplacementGroupResponseWsDTO",
"result": [
{
"errorMsg": "Successful completion",
"requestId": "",
"statusCd": "0000"
}
]
}
This happens when we do not have dto-level-mapping for the response dto.
Please suggest how and from where this attribute is getting added.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

Hi

As you have already noticed the type attribute is added to json response if you do not have a DTO mapping defined. It will also be added for subclasses of your response and in other scenarios where marshaller does not have a full type information on the controller level (in compile time).

Similar attribute will be added to xml response. Its purpose is to allow bidirectional mapping of the response - so you could use it as web service input as well. It is automatically added by the marshaller (Ee MOXY) and there is not much you can do about it.

The only way of not seeing it is to not use generics, subclasses and java.lang.Object in your type structure.

Answers (0)