Error: Malformed JSON: Expected '[' at the beginning of List/Set
I think I have incorrect JSON.deserialize
for my object. How can I fix it? I don't use a wrapper.
List<Account> accList = new List<Account>();
public static HttpRequest createRequestForService(){
HttpRequest finalRequest = new HttpRequest();
finalRequest.setHeader('Authorization','Bearer ' + 'my_token_here');
finalRequest.setHeader('Content-Type','application/json');
finalRequest.setHeader('accept','application/json');
finalRequest.setMethod('GET');
finalRequest.setEndpoint('https://name.salesforce.com/services/data/v44.0/query/?q=SELECT+Name+FROM+AnotherObject__c);
return finalRequest;
}
//My code here
//and incorrect deserialization (Error is here):
accList = (List<Account>)JSON.deserialize(responseService.getBody(), List<Account>.class);