Open mariusa opened 1 year ago
Hi Marius, thanks for your input. https://jsoneditoronline.org/ already has auto repair capability:
After pasting in text mode:
After pasting in tree mode:
Is that what you mean?
Hi Jos, thanks. I see, so one has to paste with Tree mode, not with Text mode, which isn't intuitive. Would it be possible to auto-repair after pasting within Text mode too?
so one has to paste with Tree mode, not with Text mode, which isn't intuitive.
Not really, all you have to do in text mode is click the big red "Auto repair" button bottom right.
What I find important is that the editor not "automagically" makes changes in content, but that you as a user are in control. It is an interesting idea though to automatically repair contents in text mode too, like in tree mode, as long as there is this clear message at the bottom allowing you to revert the changes and do it yourself. Let me think about it.
click the big red "Auto repair" button bottom right.
Ah, I really missed that! That works, thanks! Feel free to handle as you wish then, or close the issue
Well, I really like your idea. I think normally you paste JSON to do something with it and get it fixed. So if you paste invalid JSON, you will normally always click the "Auto repair" button right after that. So it makes sense to me to automatically "click" the button for you and show a button to undo the repair action instead for the edge cases.
So let me keep this issue open and change the title according to this plan.
Perfect! Thanks for being open to feedback :)
Hey @josdejong I would really appreciate this feature. I currently have the problem that the pasted json content is not recognized as unformatted. I guess because it is not "compact" enough. If it was auto formatted anyway that would resolve this issue.
@drik98 this issue is about auto repair, which is different from auto format. I think it should be configurable, and I can imagine something like an "auto format on save" feature too (not part of the editor but maybe of https://jsoneditoronline.org).
At https://www.freeformatter.com/json-formatter.html#before-output I can paste this
{ age: 22 }
and it will format to add quotes for attributes, eg
"age"
Please allow the same for https://jsoneditoronline.org/