Question

6
Replies
5439
Views
NIKUBHAN Member since 2009 14 posts
PayPal
Posted: 4 years ago
Last activity: 4 years 2 months ago
Closed
Solved

How to parse json string in Pega 6.2 sp2

I have a CONNECT REST Service returning me a json response. By creating the classes & properties I have mapped all the response data onto clipboard properties. One of the propertiy value itself is a string in json format. How can I parse this json string & set the name value pairs into sub-properties in that page? Java parsing code requires importing of JSON packages

import org.json.simple.JSONArray;

import org.json.simple.JSONObject;

import org.json.simple.parser.JSONParser;

which throws an error in Pega.

The JSON Response from REST service in SOAP UI is as below:

Note the selectedProviders element in red is the one containing the json string that needs to be parsed. I have shortened the json string so please excuse any sytax errors, but hope u understood what I am looking for

{

   "result":    {

   "transactionId": "S5383520160702T061426191",

  "selectedProviders": { "ts": "278571179974", "txnid": "123456789ABCDEF0", "network": "52", "psc": "199367", "fipsCountyCode": "NE1234", "cmsCountyCode": "5678"}

   },

   "status": {"messages": [   {

      "code": "1000",

      "name": "SUCCESS",

      "severity": "INFO",

      "description": "Successful service call",

      "transactionId": "487d4f0f-aacc-42ca-b745-d273c955444a"

   }]}

}

PLEASE don't ask me to upgrade which I will be doing next year!!

Data Integration
Moderation Team has archived post
Share this page LinkedIn