So for example, System.log(object) will log a flat JSON string to the console by default.
The other week, one of guys that I’m working with on my current engagement pointed me towards the space parameter of JSON.stringify().
Here is the syntax from MDN:
Making use of this parameter will allow you to insert white space into the output JSON string for readability purposes.. which is a massive help when it comes to debugging a large object or saving it to a file as a string.
The screenshot below uses the following line of code:
System.log(JSON.stringify(object, null, 2);
null in place of the replacer parameter because I’m not going to be using it.