I need a method to render JSON in a format that is easy for humans to read. Specifically, I’m interested in techniques that add structured indentation, line breaks, and possibly incorporate style enhancements like distinct colors or font changes to highlight different data sections. For instance, one might consider a solution like the example below:
function formatData(objectInput) {
let beautifiedData = JSON.stringify(objectInput, null, 3);
return beautifiedData;
}
const testObject = { userId: 101, userName: 'Alice', details: { status: 'active', role: 'admin' } };
console.log(formatData(testObject));
Any additional ideas or tips to further refine the output would be welcomed.