My Class
global class CreditActionSessionObjMgmt
{
@future(callout=true)
static webservice void deleteSessionRecord(String sessionRecIds)
{
if(sessionRecIds != null )
{
List<nForce__Session__c> objList = (List<nForce__Session__c>)system.JSON.deserialize(sessionRecIds,List<nForce__Session__c>.Class);
if(objList != null && objList.size()>0)
{
System.debug('Delete records:'+objList);
delete objList;
}
}
}
}
Test class i have written is
@istest
public class CreditActionSessionObjMgmt_test{
static testmethod void deleteSession(){
string str = ' { [ {"attributes" : {"type" : "nForce__Session__c","url" : "/services/data/v45.0/sobjects/nForce__Session__c/0039000001QYYa4AAH" },"Id" : "0039000001QYYa4AAH", "Name" : "Burlington Textiles Corp of America"}} ]}';
test.starttest();
CreditActionSessionObjMgmt.deleteSessionRecord(str);
test.stoptest();
}
}
Error Im getting
System.JSONException: Malformed JSON: Expected '[' at the beginning of List/Set Stack Trace Class.System.JSON.deserialize: line 15, column 1 Class.CreditActionSessionObjMgmt.deleteSessionRecord: line 8, column 1