Want to save the raw JASON request from REST API POST method in Pega 8.7.1

Hi All,

I’ve a requirement to log the Raw Request JASON for Rest-Service POST method in BLOB to be sent to external team if case of any failure scenario.

To achieve this, I tried with both SERIALIZE and @(Pega-RULES:Page).pxConvertPageToString(tools, mystegpage,“JASON”) but in both the scenarios I’m getting the JASON with the pxObjClasses. But I want to get the raw format of JASON(the one we get in pyRequestData). Any suggestions how I can achieve it. I’m in Pega 8.7.1 version.

Thanks and regards,

Debasmita

@DEBASMITA

This is expected behavior, when converting the page/pagelist into json by using function then pxObjclass will get included in return JSON value. In pega OOTB we are not having any logic to exclude pxObjclass during the conversion.

But by using regex function you would be able to remove the pxObjclass from return json value. Please refer below article to know how to remove pxObjclass from JSON.

Eliminate pxObjClass in JSON String using Regex (simplypega.blogspot.com)

@Gunasekaran_Baskaran

Thanks for your response. But the solution worked for the body’s 1st obj class only. Example :

{pxObjClass:“ABC”,Property 1 :“PropertyValue” , Pagelist[ {PgProperty1 : “PgPropertyValue”, pxObjClass:“”},{ {PgProperty1 : “PgPropertyValue”, pxObjClass:“”}]}

It’s working for the first pxObjClass only(given in bold) but not working for the pagelist ones. Any idea if I can remove it for them as well?

Thanks and regards,

Debasmita

@DEBASMITA

you can try creating a data transform of json data model format and skip required properties (Example: pxObjClass) and invoke it on the top level page where your pagelist exists

@kalls4

Thanks it worked..

Regards,

Debasmita