jsoneditor icon indicating copy to clipboard operation
jsoneditor copied to clipboard

Provide auto-format capability

Open davidjenkins opened this issue 5 years ago • 1 comments

Would be nice if after typing, if JSON is valid, that format and repair ran automatically.

Alternatively, add format(), compact(), and repair() to the documentation and the @types so we can control it ourselves. I think that would be better.

This would also satisfy #1153

davidjenkins avatar Dec 26 '20 18:12 davidjenkins

Thanks, makes sense to expose format(), compact(), and repair().

I also would like to make the "repair" function more notable when the contents is invalid JSON that can be repaired, maybe with a message bar on top suggesting to click "auto repair".

I think the default behavior should not format or repair automatically when loading a file, that depends on the use case. In general I think it should be a decision of the user instead of seeing your files magically differ from what you where loading.

josdejong avatar Dec 30 '20 10:12 josdejong