Is it possible to pass value null in JSON request?

Hi,

I’ve a question. I’ve a Data transform that set values in a Page. And this Page is passed to a Data_Page that invoke an external service rest, using the page as Request.

Now, for some reason, I need to pass a null value.

Let’s give an example of what I expect:

​
{
   "var1":"value1",
   "var2":"value2",
   "var3": null
}

How can I accomplish this?

I’d like to understand if Pega provides a method, a value or anyhting else, to set the value of a property to null, or to a value that the Invoke rule would translate into null value.

Best regards

@DanieleD9965

Hi you create a Json DT in pega and then set the empty behaviour as null . Using this I was able to pass null in JSON.

In my case pyNote property is empty. So Pega is setting null by default in this case. You can use the same logic .

@lakhank7thanks for your response.

I see that you are using a Data Trasform Json. Can I achieve the same result with a Data Transform clipboard?

@DanieleD9965

There are functions like pxConvertPageToString but they are only used to convert clipboard page to JSON/XML but they will not be helpful in your scenario. Also , if we use this function , the output will be containing pxObjClass which needs to be omitted before sending it to other system.

PP

@lakhank7thank again for your kind response.

The point is that i have a DT Clipboard that populates a Page. That Page is passed to a Data Type, that use to populate it as Page Request of a connect-rest.

So I do not use json

I have something like this, in my DT:

PageReq.var1 = "val1"
PageReq.var2 = "val2"
PageReq.var3 = ?

than PageReq it’s going to populate a Request in a Connect-Rest, leaving the translation in json to the internal Pega method. I’d like to know what value put for var3 in order to allow Pega to send as Request of Connector the value null.

Your solution is good, but non applicable in my scenario

@DanieleD9965 I dont think there is any OOTB rule which can help you in your scenario. You need to either create a custom function .