-1

I have textarea object and show the json in it, (show the default json and let user edit)

As default, it shows like this

[{"a":"data","b":"data"}]

However if I can show the data like this, it is better for user.

[
  {
    "a":"data",
    "b":"data"
  }
]

Is it possible to do this in textarea?

whitebear
  • 11,200
  • 24
  • 114
  • 237
  • Does this answer your question? [Prettify json data in textarea input](https://stackoverflow.com/questions/26320525/prettify-json-data-in-textarea-input) This too may help: [Prettify JSON data in textarea input in JavaScript](https://www.tutorialspoint.com/prettify-json-data-in-textarea-input-in-javascript) – admcfajn Aug 28 '23 at 14:57
  • Use the third parameter to `JSON.stringify()` https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify – Daniel Beck Aug 28 '23 at 14:58
  • Does this answer your question? [pretty-print JSON using JavaScript](https://stackoverflow.com/questions/4810841/pretty-print-json-using-javascript) – 0stone0 Aug 28 '23 at 15:03

0 Answers0