Handling pxObjClass Removal from JSON Generated via @pxConvertPageToString

In Pega, the OOTB function @pxConvertPageToString() is commonly used to convert a clipboard page into a JSON string. However, the generated JSON includes the internal property pxObjClass, which is often not required when sharing the payload with external systems or downstream integrations.

Since the presence of pxObjClass depends on the underlying Pega page structure, we need an additional step to cleanse the JSON and produce a clean, consumer-friendly output.

Step 1: Convert Page to JSON String

Use the standard OOTB function: @pxConvertPageToString()

Step 2: Remove pxObjClass Using Regex

To strip all occurrences of pxObjClass from the JSON string, we can leverage the regex function:

@pxReplaceAllViaRegex(Param.Output,“(?s)(,\s*"pxObjClass"\s*:\s*"[^"]+")|(\s*"pxObjClass"\s*:\s*"[^"]+"\s*,?)”,“”)