I want to send data in a json format to API to fetch data. but when i'm using the below code, i'm getting error like this in the log I think the data is not converted as Json String like for this record . I have a data set "Input_data" with columns like "vCustomerFirstName, vCustomerLastName, vCustomerMiddleName, nCustomerGender, vCustomerPhoneNumber, vCustomerDateOfBirth, vCustomerIDProofDocumentName and vCustomerIDProofDocumentNumber". Help required - method to send dataset in a json string format to API and saving the output. /* Code */ /* Create an empty dataset to hold the output */ data output_data; length response $32767; stop; run; /* Read the JSON string from the input dataset */ data ; set inputs_2; length json_string $3200; json_string = cats('{ "vCustomerFirstName": "', vCustomerFirstName, '", "vCustomerLastName": "', vCustomerLastName, '", "vCustomerMiddleName": "', vCustomerMiddleName, '", "nCustomerGender": "', nCustomerGender, '", "vCustomerPhoneNumber": "', vCustomerPhoneNumber, '", "vCustomerDateOfBirth": "', vCustomerDateOfBirth, '", "vCustomerIDProofDocumentName": "', vCustomerIDProofDocumentName, '", "vCustomerIDProofDocumentNumber": "', vCustomerIDProofDocumentNumber, '"}'); json_string = compress(json_string, ' '); run; /* Put the JSON string in an external file */ filename json_in temp; data _null_; file json_in; put json_string; run; /* Post the JSON query to the API and get the response */ filename resp temp; proc http method="POST" url=url ct="application/json" in=json_in out=resp; run; /* Read the response from the API and save it in the output dataset */ data _null_; infile resp; input; response = _infile_; run; /* End of the code */
... View more