Closed k-byun closed 3 years ago
Ruling out the string length to troubleshoot - this also does not sort:
[ { "destination": { "id": "xx-abc-b-diskuse01" } }, { "destination": { "id": "xx-abc-b-diskall01" } } ]
Hi. The extension doesn’t rearrange array positions - instead it only rearranges keys as they has no impact on the meaning of the JSON.
Good to know. I am using notepad++ to compare two JSON files but because the same content is positioned in different positions of within the same array in two different files, it's being detected as difference. Figured sorting both version would align and sort out this so I found your tool to pre-process this in vs code, then pass it to notepad++ - there might be a simpler process which I am not aware of.
I may make a pull request of your add-on extension to implement this later this week/month. Thank you
Hi. Array sorting is not something this extension is designed for - if you want an array sorting extension then that should be a separate extension :). Array position order has meaning, dictionary key order doesn’t.
For your specific needs, if array position does not have meaning, then it may be easier for you to write a super simple JavaScript script to read in the file, sort the arrays in code, and write out the sorted arrays for comparison.
Agreed. That's what I will do. Thanks!
@richie5um @k-byun I think this can be closed
=> diskalloc01 should appear first but it doesn't.