sorts JSON into groups without requiring hard-coded names