Question
When I select JSON format as input source data for REST API POST execution process and perform conversion to JSON data, "" (two double-quotation marks) is set if the value is empty for string type.
Is it possible to set null instead of these empty?
Example
If the second item is empty, "" is set as shown below,
"priceQuotationGrp": {
"priceQuotationId": "CIF",
"priceQuotationPlaceId": "",
},
Can we set null as follows?
"priceQuotationGrp": {
"priceQuotationId": "CIF",
"priceQuotationPlaceId": null,
},
Answer
If you want to set null when the string data value is empty when converting input source data to JSON data, you can accomplish it by specifying the data type when converting the data to JSON format by making a conditional branching based on whether the input source data value exists or not.
As an example, the following is an implementation procedure for converting CSV to JSON data.
1. Prepare a script that reads a CSV file, maps it to JSON data, and executes POST.
2. In the mapping, develop the following process for the string data for which you want to set null for empty data.
-Convert to null if the data is an empty character with Replace Empty String logic.
-Check the data if its value is null or not with Check Null logic.
-Output string if the data exists and null if not with If logic.
-Store the output value in the destination of the data type.
Supplementary information
For details on JSON data conversion in the Execute POST operation, please refer to the following manual page.
Documentation
2.6.1.6 Network > 2.6.1.6.2 REST > 2.6.1.6.2.2 Execute POST- Schema
https://www.hulft.com/help/en-us/HULFTSquare/Content/Designer/Connector/rest_execute_http_post.htm
Comments
0 comments
Article is closed for comments.