-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request - Sorting JSON Objects by Attribute #689
Comments
Right after I submitted that issue I had an idea for a workaround doing basically this
But |
Good suggestion. The problem here would that JSON maps are unordered (as per the JSON specification) so the output cannot be That said, I don’t think your request is an unreasonable one. It might just need a little bit of magic to get working right. |
@tiymat I think the best approach here, since we are talking about relational data, is probably to convert the object to a table. eg
reformat as a CSV:
run SQL against table:
a formatting from a map to a table fix is in the commit above (7d86cc2) and, currently, you cannot convert from a table back to a map |
Makes sense, haven't tested it yet but I think that would work for the use case I envisioned that caused me to make this feature request. I actually had no idea about the |
I believe this should have been closed a while ago but I missed it? |
Describe the problem:
It would be really cool to be able to sort an array of JSON objects based on a given attribute.
Possible ways to implement:
Possibly
msort
could have a flag indicating which attribute to sort on? Or, even better, the flag could accept multiple arguments (comma-separated?) So first the objects are sorted on the first attribute, and then all of the objects with the same value for that attribute are sorted on the second attribute, etc.Additional context:
msort
's current behavior seems to be to sort using the attributes in alphabetical order, unless I'm misunderstanding it.My request is to be able to sort on a specific attribute like
Name
, e.g.Documentation:
Please rate your success with referring to the docs @ https://murex.rocks
Maybe there's already a way of doing it, but if so I wasn't able to find it in the documentation.
The text was updated successfully, but these errors were encountered: