我有這樣如何將json數據首先用數字,第二大寫字母和字母順序排序,然後按字母順序排序?
[ { groupType: '1',
id: '158',
unreadMessages: '8',
ownerId: '332',
name: 'porras group' },
{ groupType: '1',
id: '163',
unreadMessages: '0',
ownerId: '337',
name: '11..' },
{ groupType: '1',
id: '173',
unreadMessages: '0',
ownerId: '334',
name: 'cate\'s' },
{ groupType: '1',
id: '174',
unreadMessages: '0',
ownerId: '328',
name: 'raju' },
{ groupType: '1',
id: '175',
unreadMessages: '0',
ownerId: '332',
name: 'abcde' },
{ groupType: '1',
id: '177',
unreadMessages: '0',
ownerId: '337',
name: '26 feb' },
{ groupType: '1',
id: '181',
unreadMessages: '0',
ownerId: '332',
name: 'new' },
{ groupType: '1',
id: '182',
unreadMessages: '0',
ownerId: '337',
name: 'jchhabra group' },
{ groupType: '1',
id: '186',
unreadMessages: '0',
ownerId: '337',
name: 'jch' },
{ groupType: '1',
id: '189',
unreadMessages: '0',
ownerId: '332',
name: 'hebe' },
{ groupType: '1',
id: '191',
unreadMessages: '0',
ownerId: '328',
name: 'ccgg' },
{ groupType: '1',
id: '202',
unreadMessages: '0',
ownerId: '332',
name: 'New Porras Group' },
{ groupType: '1',
id: '205',
unreadMessages: '0',
ownerId: '339',
name: 'simgroup' },
{ groupType: '1',
id: '210',
unreadMessages: '0',
ownerId: '339',
name: 'check' },
{ groupType: '1',
id: '222',
unreadMessages: '1',
ownerId: '333',
name: 'jgonzalez group' },
{ groupType: '1',
id: '223',
unreadMessages: '0',
ownerId: '334',
name: 'Cate 2' },
{ groupType: '2',
id: '150',
unreadMessages: '0',
ownerId: '0',
name: 'BACKSTAFF Group 2' },
{ groupType: '2',
id: '158',
unreadMessages: '0',
ownerId: '0',
name: 'BACKSTAFF Group' },
{ groupType: '2',
id: '173',
unreadMessages: '0',
ownerId: '0',
name: 'BACKSTAFF Group 3' } ]
一個JSON數據,我想有點像
- 11 ..
- 2月26日
- BACKSTAFF集團
- BACKSTAFF組2
- BACKSTAFF Group 3
- Cate 2
- 新波拉斯集團
- ABCDE
- 美食的
等是可能的JSON列表進行排序像字母 數字第一則大寫字母和休息 按字母順序排列。
是這個問題有關的任何特定的編程語言?如果沒有在http://codegolf.stackexchange.com/詢問,請點擊這裏 – Kira
這是在node.js –
你想重新排序集合中的屬性或對象嗎?如果屬性是問題,我認爲您需要更改類中的屬性順序,然後重新進行串行化。如果集合中的對象是你想要排序的東西,你可以反序列化,並使用.OrderBy()和再次reserialize – meJustAndrew