Error: call to URL https://cs31.salesforce.com/services/apexrest/CreateLoan/ failed with status 400, response HTTP/1.1 400 Bad Request Date: Sat, 27 Feb 2016 09:22:27 GMT Set-Cookie: BrowserId=Dn8n41hbQLCLGe4ztf5mbg;Path=/;Domain=.salesforce.com;Expires=Wed, 27-Apr-2016 09:22:27 GMT Expires: Thu, 01 Jan 1970 00:00:00 GMT Content-Type: application/json;charset=UTF-8 Transfer-Encoding: chunked [{"message":"Unexpected character ('}' (code 125)): was expecting double-quote to start field name at [line:25, column:6]","errorCode":"JSON_PARSER_ERROR"}], curl_error , curl_errno 0
-
Can you post the payload JSON ?– karthikselvaFeb 27, 2016 at 9:34
-
welcome to SE, while asking a question always put as much information you can put with your question it will help other to understand your problem and provide a solution without any additional communication.– HimanshuFeb 27, 2016 at 10:53
1 Answer
You are passing a JSON which is not constructed properly.
You have a trailing comma
,
at the end of last key-value pair, so JSON parse assumes you are going to declare few more variables. But since you abruptly close it with}
it fails in parsing it.Assuming by the error message you have error at Line:25 column 6 your json string should look something like below>
Payload:
json_string = '{ "a":"b",
.
"field": "value",
} // Line 25
Solution:
Remove the trailing comma and Change it to:
json_string = '{ "a":"b",
.
.
"field": "value"
} // Line 25
and it should work fine
-
Thanks @karthilselve. It works. It has solved my json error but it showing another error about partner code like following Error: call to URL cs31.salesforce.com/services/apexrest/CreateLoan failed with status 200, response HTTP/1.1 200 OK Date: Tue, 01 Mar 2016 06:28:22 GMT Set-Cookie: BrowserId=Ac5bU4LPSGi6eBUg0wJdYg;Path=/;Domain=.salesforce.com;Expires=Sat, 30-Apr-2016 06:28:22 GMT Expires: Thu, 01 Jan 1970 00:00:00 GMT Content-Type: application/json;charset=UTF-8 Transfer-Encoding: chunked " message - Invalid Partner Code,", curl_error , curl_errno 0 Mar 1, 2016 at 6:30