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
Srinivasa Rayapuri 2Srinivasa Rayapuri 2 

"Error while deserializing: N/A at [line:1, column:2242]"


I have a REST Class exoposed from salesforce is used to create an Account and Contact from a web form elsewhere in the company. 

It was working fine until 2 days ago and now i have the error (in description). 

Can anyone please help me understabd why?

Thanks in Advance
Hi ,

What type of error are you getting?
explain the little bit.

Mukesh Kumar
Srinivasa Rayapuri 2Srinivasa Rayapuri 2
Hi Mukesh 

The only error i get, when the API is inserting a record into salesforce is this "Error while deserializing: N/A at [line:1, column:2242]" and the column number is not same all the time; meaning 
Insert 1 -> Error while deserializing: N/A at [line:1, column:1123]
insert 2 -> Error while deserializing: N/A at [line:1, column:2324]
Insert 3->  Error while deserializing: N/A at [line:1, column:1748]

There is an application form hosted on a website and when someone fills the information and clicks on Submit, it creates records (Account & Contact) in salesforce. 

This is the API Class 
global with sharing class AccountContactWebService
    global static string strExecStepsJson='';
    static string sPersonEmail ='';
    /* This method Accepts the json Request from hantec forms and parse the data*/ 
    global static string createRecords() 
        String jsonStr ='';
        String strResponseFinal;
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
        if(req!=null && req.requestBody!=null) jsonStr = req.requestBody.toString();
        system.debug('jsonstr ===>'+jsonstr);
        if(jsonStr.startsWith('\"'))jsonStr = jsonStr.removeStart('\"');
        if(jsonStr.endsWith('\"')) jsonStr = jsonStr.removeEnd('\"');
        jsonStr = jsonStr.unescapeUnicode();
        system.debug('jsonstrfinal ===>'+jsonStr);
        CreateAccount.AccountWrapper deserializedJSONObj = new CreateAccount.AccountWrapper();
        Boolean isValidJSON = true;
            deserializedJSONObj = (CreateAccount.AccountWrapper)JSON.deserialize(jsonstr, CreateAccount.AccountWrapper.class);
            system.debug('****into accepting  root****'+ deserializedJSONObj);                        
        }catch (Exception ex){
            isValidJSON = false;
            System.debug('error: '+ex);   
            JSON_Logs__c log = new JSON_Logs__c();
            log.Reason__c = 'Error while deserializing: ';
            log.Full_Error_Log__c =  ex.getMessage();
            strResponseFinal = 'Error while deserializing: ' + ex.getMessage();
                insert log;
            catch(Exception exc)

        if(isValidJSON == true) strResponseFinal = CreateAccount.createAcc(deserializedJSONObj);
        return strResponseFinal;

Now i am trying to find out whats causing the deseriaisation error.


SFDC Dev1 13SFDC Dev1 13
@Srinivasa Rayapuri 2
Were you able to resolve this issue? i'm having the same issue, i posted here