How can I format an object to be displayed as a structured string like with <pre>
, without using jQuery?
This is how my object currently appears when using console.log
.
Object
title: "Another sting"
type: "tree"
options: Object
paging: "20"
structuretype: "1"
columns: Object
...
description: "This is a string"
...
What's the best way to convert it to a nicely formatted string?
My solution attempt:
I attempted using stringify()
to generate a JSON structure. I could create my own parser, but I'm wondering if there are existing implementations available.