I was using textarea to display the json in string format, for that I used this
JSON.stringify(this, null, '\t')
To solve some issue in textarea positioning I decided to use contenteditable div. How to show json in contenteditable div as
BusinessUnit : {
"title": "Business Unit",
"type": "Text",
"options": "",
"required": true,
"defaultValue": "1",
"tooltip": "This is a Business-unit",
"unique": true
}
rather than as a showing it as string
BusinessUnit : { "title": "Business Unit", "type": "Text", "options": "", "required": true, "defaultValue": "1", "tooltip": "This is a Business-unit", "unique": true }
The easiest thing to do would be to either use a contenteditable <pre>
element instead of a <div>
, or add white-space: pre
to the <div>
's CSS.