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
davcondevdavcondev 

Viewer for debug log variables?

A class variable I'm looking at in the debug log is 50k chars long and has 4 levels of nested classes/objects, which means it's pretty much unexaminable in plain text. I'd like to view it in a formatted tree, ideally collapsible. Does such a viewer exist?

 

Since the structure is json-like I tried using http://json.parser.online.fr/ but it's not well formed enough.

 

I was able to format the output using http://jsonviewer.stack.hu/ but now it's 30 pages long so I'm not much better off without collapsibility.

 

Is there a find/replace sequence I can use to json-ise my var?

Best Answer chosen by davcondev
davcondevdavcondev
Just use

System.debug(JSON.serializePretty(sobjectvariable));

All Answers

Satish_SFDCSatish_SFDC
I dont know of any such parsers/viewers which could help examine the log / variable in a much more clearer way.
You may however loop through the class variable and write your own system.debug statements to print out the individual properties.

Regards,
Satish Kumar
davcondevdavcondev

Thanks for the response.

 

I have posted idea "Format debug log variable output as JSON" for this.

 

https://success.salesforce.com/ideaView?id=08730000000kx5fAAA

davcondevdavcondev
Just use

System.debug(JSON.serializePretty(sobjectvariable));
This was selected as the best answer