In apex I retrieve a list of sObjects and store them in a list. So it looks like this: public static List<sObject> listOfSobjects {get;set;}
And then I query for this sobject from the db:
listOfSobjects = [SELECT Id, Value1, Value2, (SELECT Id FROM sObject2) FROM Sobject WHERE Status__c != 'Rejected'];
So then I try to access this in JavaScript and assign it to a JavaScript object but I get an error. Even console.log gives me an error console.log({!listOfSobjects});
The error looks like this: Uncaught ReferenceError: a0H3B000000EWilUAG is not defined
Also in sources
of the inspector that line of code looks like this console.log([a0H3B000000EWilUAG]);
Any ideas why I am getting an error in the console.log and also how to assign this list to a javascript object? Thank you.