Support Article
Requirement for double quotes for properties instead of null
SA-59530
Summary
Malformed JSON request was generated on sending empty values to Boolean, Integer, Decimal or Double type properties and HFix-35253 was provided to resolve it. Post applying HFix-35253, Pega generates JSON request with null values for Boolean, Integer, Decimal or Double type properties when empty value is provided for these type of properties.
Requirement for double quotes ("") for the properties instead of null for the use case.
For example,
The below sample response is generated by Pega post installing HFix-35253:
{ "TestBooleanRes":null,"TestDecimalRes":null,"TestIntegerRes":null,"TestDoubleRes":null}
User needs the response generated by Pega as below when empty values are sent to Boolean, Integer, Decimal or Double type properties:
{ "TestBooleanRes":"","TestDecimalRes":"","TestIntegerRes":"","TestDoubleRes":""}
Error Messages
Not Applicable
Steps to Reproduce
- Install HFix-35253
- Create a Service-REST integration
- Return the empty value to the Boolean, Integer, Double and Decimal type properties as response of the Service-REST integration. The empty values for Boolean, Integer, Double and Decimal properties are replaced by null
Root Cause
This behavior is as per the JSON specifications.
Resolution
Here’s the explanation for the reported behavior:
According to the JSON specification, null represents a missing or an empty value. Representing the empty or missing value as 'False', 0 or "" is incorrect.
Published May 7, 2019 - 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.