Search code examples
restatg

FIlter out "class" from REST output json


ATG version : 10.2 We are having few custom classes as beans. But, in response JSON, ATG is adding the "class" as following :

"errorCode": "invalidQuery",
    "class": "abc.xyz.RestCustomErrorMap",
    "errorSpcMessage": [
      {
        "value": "2-17410520",
        "class": "abc.xyz.CustomMapType",
        "key": "campaignId"
      },
      {
        "value": "1-3TQ2",
        "class": "abc.xyz.CustomMapType",
        "key": "productId"
      },

As given in the documentation link I have tried to include the configuration file as

<?xml version="1.0" encoding="UTF-8"?>
<rest-filtering>

	<component name="abc.xyz.RestCustomErrorMap" default-include="true">
		<property name="class" hidden="true" />
	</component>
	
	<component name="abc.xyz.CustomMapType" default-include="true">
		<property name="class" hidden="true" />
	</component>
	
</rest-filtering>

But still not able to filter out the "class" property from response json !!


Solution

  • Try this:

    <component name="abc.xyz.RestCustomErrorMap" default-filter="summary">
        <filter id="summary" default-include="false">
            <property name="class" hidden="true" />
        </filter>
    </component>