Picture Excel data, rows and columns, with the ability to sort either for ASC or DESC on any column.
I'm looking to replicate this functionality within Java then output the data into JSON - This JSON data is being placed within an API that can be queried and return tabular style data which is sorted based on a specific column name.
What is the best approach to this?
JTable seems to look like it may help, https://docs.oracle.com/javase/tutorial/uiswing/components/table.html#sorting, although I'm currently unsure how to then map this data that is filtered into a JSON object.
Any pointers / thoughts?
See my example below. I have used GSON dependency shown below to convert a Vector to a JSON string. And I have used JTable.convertRowIndexToModel() API to get table rows in correct order.