Question
Last activity: 29 Jan 2016 13:24 EST
Modify JSON response Pega 7.1.7
Hi ,
I need to modify the one property name in JSON response.I found the below post from Mesh and PDN. But I don't see pzExternalName property qualifier in pega 7.1.7 as mentioned in it. is there any other way to do it ?
Re: How to modify the response JSON?
https://pdn.pega.com/support-articles/json-mapping-exception-after-migrating-pega-718
https://pdn.pega.com/support-articles/json-invalid-property-error-when-prop-name-starts
Thanks
Nagendran Arumugam


Pegasystems Inc.
IN
Hi Praneeth ,
We have a property named CustomerID , but the client is expecting field to be CustomerId in response. so when generating the JSON response I need the tag to be CustomerId not CustomerID.
Thanks
Nagendran Arumugam


Pegasystems Inc.
AU
It's been a little bit since I've used 7.1.7 and I can't recall if it uses the same mechanism, however are you able to add pzExternalName manually and test if that has the desired effect?
I don't see pzExternalName in 7.1.7 , but this article(SA-14881) says it is a OOTB property qualifier . Not sure if it is added in 7.1.8. is there any other way to achieve this ?


Pegasystems Inc.
IN
Yes, the property qualifier pzExternalName was added in 7.1.8. But we recently ported this fix to 7.1.7. You could take this hotfix.


Pegasystems Inc.
IN
You need to take HFix-25262.
Thanks Praneeth, I'll install the hot fix and see if it works.


Pegasystems Inc.
US
Please reply with the SR number that you created in order to obtain the Hot Fix so we can track it and connect your SR and this post in the Community.
Thanks!
Hi Marissa,
SR-A16983 opened to get hot fix.


Pegasystems Inc.
US
Thank you!
Hi ,
I installed the hotfix and added pzExternalName in property qualifier but it did not work. Still the Json response is generating with propertyname and not with the value given in propertyqualifier value.
please find the screen shot and response generated
"CustomerCase": [
{
"AgreementId": "1E571B850B6B03208D00005056A74B06",
"AssetId": "1E571B850AAA05308D00005056A74B06",
"ClientAccountId": "1E571B85091500D08D00005056A74B06",
"CustomerCaseId": "1E5AE757605107809AE9005056A74B06",
"CustomerCaseNumber": "1012119193",
"CustomerCaseStatus": "CMPLTD",
"CustomerId": "1E571B85091707E08D00005056A74B06",
"IncidentType": "DAMAGE",
"StartDate_str": "20151229T214521.797 GMT",
The response should contain StartDate instead of startdate_str


Pegasystems Inc.
IN
Are you parsing JSON and mapping to clipboard or generating JSON from clipboard?
I'm generating JSON from clipboard
Thanks
Nagendran Arumugam


Pegasystems Inc.
IN
I just verified at my end and the outbound works as expected. After installing the hotfix, have you restarted your server?
Hi Praneeth ,
We recycled the servers. This is what we are doing. we set the response property in data transform.
I set Property Startdate_str in data transform. I have mapped pzExternalName value to StartDate in Startdate_str property. we generate JSON response using function responseObjPage .getJSON( false );
I'm expecting JSON response to contain tag StartDate instead of StartDate_str. please let me know if i'm missing something.
Thanks
Nagendran Arumugam


Pegasystems Inc.
IN
If you are using property qualifiers, you are not supposed to generate JSON using the clipboard API getJSON(). You should instead have Map From as JSON on the response tab of your service REST rule and Map From Key should be the embedded page property whose JSON representation you need.
Hi Praneeth ,
I'll check on this and let you know if it works.
Thanks
HI Praneeth ,
is there any way to use getJSON() API and acheive this functionality? we use a common activity which gets the response page as parameter and generate the response for all the services so we will not be able to use Map from JSON.
Accepted Solution


Pegasystems Inc.
IN
No Nagendran, you cannot use getJSON() and achieve this. getJSON() isn't aware of property qualifiers.
Thanks praneeth. I think we cannot use this function then. is it possible to tell me the class the MAP from JSON uses to generate the JSON ? may be i'll try to write some java code around the class and see if it works.


Pegasystems Inc.
IN
The method used by Map from JSON is tools.getServiceUtils().mapOutboundData(). You could see its usage in step 5 of Rule-Connect-REST.Invoke activity.
Thanks Praneeth , I'll check if I can use it in our code.
Can you tell me what's the JSON field name which you want to map to a Pega property?