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
Andrew KulikAndrew Kulik 

debuging LWC objects stuck in proxy

It seems something has changed in Salesforce recently and now when debugging in the browser dev console or trying to use a console log to access a JS object or data everything is stuck in a proxy object. Does anyone know of how to get JS object out of the proxy object?

The below used to work but it doesn't work any more.

console.log(JSON.parse(JSON.stringify(obj)));
Arun Kumar 1141Arun Kumar 1141
Hi Andrew,
You may check the code below to see how I built the object in js, assigned it to my new proxy object, and added some console. It works as intended:-
const sfdc = {
            "commerce": "B2B",
            "service": "Omni"
        }
        const proxySfdcInstance = new Proxy(sfdc, {
            get: (target, key) => {
                return target[key];
            }
        })
        console.log("dataString-->" + JSON.stringify(proxySfdcInstance));
        console.log("dataString-->" + JSON.stringify(proxySfdcInstance));
        console.log("last line--" + JSON.parse(JSON.stringify(proxySfdcInstance)));

Please mark it as the best answer if it will help you.
Thanks