Hello,
We are trying to fill-in the pincode of a customer through an API call. The API returns the values in JSON format such as:
{"query":"Delhi","pincode":"110001"}
If the pincode cannot be found, the API returns with the values such as:
{"query":"Searched Address","pincode":"","error":"Not found"}
We get a "Invalid JSON string format" error when address fields are left blank on add customer record form. The code we are using to make the API calls is:
if (input.Address_Line1 != null || input.Address_Line2 != null || input.City != null)
{
customerAddress = input.Address_Line1 + " " + input.Address_Line2 + " " + input.City;
response = getUrl(myURL);
if (response.getJSON("pincode") != "")
{
input.Pin_Code = response.getJSON("pincode");
}
}
Don't know what exactly are we doing wrong here. Any help will be much appreciated.
Thanks!
Prakhar