BenjaminC Member since 2013 7 posts
Charles Schwab
Posted: 1 year ago
Last activity: 1 year 5 months ago

Dynamic json payload parsing over pagelists

(platform version 7.1.9)

Hey folks,

We are hosting a service that will receive a variable json payload as a text field (otherwise risk having to generate 100s of data model classes and parsing logic).

Per some other articles, I'm able to use @(Pega-RULES:Page).pxConvertStringToPage to effectively build the clipboard page from the received json (using a simple step page of type Data-). Since the json structure includes complex elements, the generated page has nested embedded pagelist properties and am having difficulty iterating over these lists given design time validation errors in DTs or activities. I'd like to avoid java if possible.. $ANY seems to not work on pagelist props anymore so am hoping others may know a trick.

Here is an example JSON structure:

"{ 'firstName': 'John', 'lastName':'Smith', phoneNumbers': [ {'type':'home', 'number':'123-123-1234'}, {'type':'other','number':'222-111-1234'}] }"

In this example, attempting to iterate over the .phoneNumbers pagelist property generates the 'the page must be of type pagelist / pagegroup design time validation errors in data transforms and activities. The only thing that kind of works now for me is to write java that converts pagelist props to code-pega-lists after the fact, but it is messy and due to the nested structure, requires a recursive approach which is costly in maintainability and complexity.

Lots of smart people out here, ultimately I'd like to be able to iterate over all properties of this dynamically generated Data- class instance to map these values to our Pega BLL classes. Thanks in advance!

***Moderator Edit-Vidyaranjan: Updated FDBK ID***

Low-Code App Development Data Integration
Share this page LinkedIn