josdejong / svelte-jsoneditor

A web-based tool to view, edit, format, repair, query, transform, and validate JSON
https://jsoneditoronline.org
Other
818 stars 108 forks source link

Recursively sort object and subobjects #305

Closed trust11 closed 6 months ago

trust11 commented 10 months ago

It would be nice when all elements would be sorted as the function is suggesting to do

josdejong commented 10 months ago

Can you explain what you mean with an example? Do you mean recursively sorting all objects for a certain path?

trust11 commented 10 months ago

Exactly

josdejong commented 10 months ago

Right now you can sort the root object via the main menu, and you can sort a nested object/array in tree mode by right clicking it, selecting "Sort" from the context menu, and then click the sort button in the popup

There is no API for for recursively sorting multiple objects/arrays in one go. If it is a common request we can consider implementing support for recursively sorting all objects/arrays. What you can do for now is implement this recursive sorting functionality yourself and add a "Sort recursively" button to the main menu via onRenderMenu.

TonyValenti commented 8 months ago

Yes. I would like a recursive sort as well.

  1. All properties should be sorted by their lowercase name.
  2. The order of array elements should remain unchanged.

Thanks so much!

josdejong commented 6 months ago

Moving this idea to the Discussions > Ideas section since we are not actively working on it. At this point I'm not sure if it is a common enough request to implement it.