function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
kallam salesforce1kallam salesforce1 

I am trying to insert multiple contact records by using RESTAPI Post Method. Getting error after sending request.

Can some one help me error in Code.

    global static String CreateContacts(){
        RestRequest request = RestContext.request;
        String requestBody = request.requestBody.toString();
       list<Contact> listcon = (List<Contact>) JSON.deserialize(requestBody, contact.class);
        insert  listcon;
        return 'SUCCESS';
           return 'Failed';

REquest Body >>

  "FirstName" : "Test2",
  "LastName"  : "Vasu"
  "FirstName" : "Test3",
  "LastName"  : "Vasu"

Getting error 

message: System.JSONException: Json Deserialization failed on token 'null' and has left off in the middle of parsing a row. Will go to end of row to begin parsing the next row Class.System.JSON.deserialize: line 15, column 1 Class.AccountManager.CreateContacts: line 59, column 1 

Sai PraveenSai Praveen (Salesforce Developers) 
Hi Kallam,

Can you check if below answer helps you to resolve your issue.

If this solution helps, Please mark it as best answer.