Question
Requirement to set a blank string value to null in REST Service response
Requirement is to set a blank value to null in outbound response of the Service-REST
The blank value of Text properties are set to “” instead null
For integer/decimals it's setting null ( as expected )
Pega Service Response :-
Actual Response
{ "Application":{ "Status":"Pending-Review", "ApplyingWith":"", "InterestRate":null, "StreetAddress":"" } }
Expected :-
{ "Application":{ "Status":"Pending-Review", "ApplyingWith":null, "InterestRate":null, "StreetAddress":null } }
I don't want to use below function which removes the blank properties from the JSON but we need blank values with null ( not "")
@(Pega-RULES:Page).pxConvertPageToString(tools, myStepPage, "json")
2) Even followed the local changes mentioned here but didn't help
2.1) convert the page to json using data transform .
2.2) Map the param.jsonData to .pyJsonData
2.3) In the response tab , configured Map from "Clipboard" and Map from key .pyJsonData
Hi Brahmesh,
Returning empty string instead of null is default clipboard behaviour, changing it may lead to regression issues.
Please follow the workaround of not using Clipboard and populating Request JSON by yourself.
It can be done as follows:
1. In the request Tab give Map from clipboard and Map from key as .pyJsonData as shown in attached image.
2. Before calling the Connect-REST in an activity, populate .pyJsonData with your JSON request. You need to take care of inputting proper JSON if you use this approach.