JSON response conversion to page and page list

I have a rest connector which has a unique setup for the response. The response when successfully is sent back as a JSON object; however, the response when errored is a JSON array. Within the rest connector I can set the response ‘Message Data’ to JSON and provide a property, but this property can only be a Page List or Single Page. Is there a way to make this dynamic to accommodate the two different responses?

Successful response:

{"workItemID: string}

Errored response:

[{‘message’:‘Wrong data in the body of the request. ‘,‘error’:[{‘code’:‘OBJECT_MISSING_REQUIRED_PROPERTY’,‘params’:[‘id’],‘message’:‘Missing required property: id’,‘path’:’#/providers/0’,‘description’:‘Provider data required for creation’}]}]

I have also attempted to map to text property, but have not been successful in converting the string property holding JSON to a Page List either.

@ScotRob perhaps you might want to check how to troubleshoot REST connectors page in Pega documentation.

@ScotRob Can the response be mapped to a clipboard text property and based on the status code ( I am expecting that the status codes would be different for failure and success scenarios) can make use of RUF pxConvertStringToPage or call a data transform to map json to clipboard properties

@BhanuPrakash_G - Thank you for the response. Based on this suggestion I was able to map it to a text property and built a JSON Data Transform, called from the response data transform, to map the error response to the page. If success scenario, I could use the OOTB function pxConvertStringToPage to get the response on the page.