Support Article
connect-http rule to transfer data in the form of JSON
SA-1231
Summary
How to transfer data in the form of JSON in pega 6.1 using connect-http.
Resolution
Following is the explanation for usage of 'getPageAsJson' funciton in PRPC (till 6.3 SP1)
The below code will give the string which will have JSON of the page "pgpage".
Properties of the page with values will be in JSON format.
ClipboardPage pgpage=tools.findpage("<clipboard page>");
resultJSON= pea_rules_page.getPageAsJson(pgpage,null);
If idea is to only show some property from the page then, we can make the arraylist of those properties.
Eg:
java.util.ArrayList pgField= new java.util.ArrayList();
pgFields.add("<property name in the page>");
resultJSON= pea_rules_page.getPageAsJson(pgpage,pgFields);
The above will only give JSON with mentioned property.
If you wish to get the pagelist value, you need to add that in the pgField
pgField.add("<pagelist.property Name>");
resultJSON= pea_rules_page.getPageAsJson(pgpage,pgFields);
Published January 31, 2016 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.