使用键降序排列jSON数组

问题描述 投票:0回答:1

我有JSON数组,我想根据ID对数组进行排序,我正在使用self.sortedArray(using:aa as![NSSortDescriptor]),但它无法正确地对数组进行降序排序。例如,它基于数字对数组进行排序-ID999897302101100129012891287任何人都可以帮助我,在此先感谢。

arrays json sorting nsarray
1个回答
0
投票
   And Array is - 
 arrayServiceArea: (
            {
            EastLong = "-93.75794140624993";
            NorthLat = "39.05409190054223";
            ServiceAreaBroughtBy = TS;
            ServiceAreaEnabled = 1;
            ServiceAreaID = 99;
            ServiceAreaName = TestSeviceAreaNew;
            SouthLat = "36.69634770234687";
            WestLong = "-98.6441171875";
        },
            {
            EastLong = "76.84724704787368";
            NorthLat = "30.72677630183756";
            ServiceAreaBroughtBy = "D to I gate 1";
            ServiceAreaEnabled = 1;
            ServiceAreaID = 98;
            ServiceAreaName = "D to I gate 1";
            SouthLat = "30.722258145962442";
            WestLong = "76.84287406394131";
        },
        {
            EastLong = "76.84724704787368";
            NorthLat = "30.72677630183756";
            ServiceAreaBroughtBy = "D to I gate 1";
            ServiceAreaEnabled = 1;
            ServiceAreaID = 97
            ServiceAreaName = "Damco to DT Mall";
            SouthLat = "30.722258145962442";
            WestLong = "76.84287406394131";
        },
            {
            EastLong = "76.84724704787368";
            NorthLat = "30.72677630183756";
            ServiceAreaBroughtBy = "D to I gate 1";
            ServiceAreaEnabled = 1;
            ServiceAreaID = 30
            ServiceAreaName = "Damco to DT Mall";
            SouthLat = "30.722258145962442";
            WestLong = "76.84287406394131";
        },
     {
            EastLong = "76.84724704787368";
            NorthLat = "30.72677630183756";
            ServiceAreaBroughtBy = "D to I gate 1";
            ServiceAreaEnabled = 1;
            ServiceAreaID = 2
            ServiceAreaName = "Damco to DT Mall";
            SouthLat = "30.722258145962442";
            WestLong = "76.84287406394131";
        },
  {
            EastLong = "76.84724704787368";
            NorthLat = "30.72677630183756";
            ServiceAreaBroughtBy = "D to I gate 1";
            ServiceAreaEnabled = 1;
            ServiceAreaID = 101
            ServiceAreaName = "Damco to DT Mall";
            SouthLat = "30.722258145962442";
            WestLong = "76.84287406394131";
        },
  {
            EastLong = "76.84724704787368";
            NorthLat = "30.72677630183756";
            ServiceAreaBroughtBy = "D to I gate 1";
            ServiceAreaEnabled = 1;
            ServiceAreaID = 100
            ServiceAreaName = "Damco to DT Mall";
            SouthLat = "30.722258145962442";
            WestLong = "76.84287406394131";
        },  {
            EastLong = "76.84724704787368";
            NorthLat = "30.72677630183756";
            ServiceAreaBroughtBy = "D to I gate 1";
            ServiceAreaEnabled = 1;
            ServiceAreaID = 1290
            ServiceAreaName = "Damco to DT Mall";
            SouthLat = "30.722258145962442";
            WestLong = "76.84287406394131";
        },  {
            EastLong = "76.84724704787368";
            NorthLat = "30.72677630183756";
            ServiceAreaBroughtBy = "D to I gate 1";
            ServiceAreaEnabled = 1;
            ServiceAreaID = 1289
            ServiceAreaName = "Damco to DT Mall";
            SouthLat = "30.722258145962442";
            WestLong = "76.84287406394131";
        },
 {
            EastLong = "76.84724704787368";
            NorthLat = "30.72677630183756";
            ServiceAreaBroughtBy = "D to I gate 1";
            ServiceAreaEnabled = 1;
            ServiceAreaID = 1287
            ServiceAreaName = "Damco to DT Mall";
            SouthLat = "30.722258145962442";
            WestLong = "76.84287406394131";
        },
© www.soinside.com 2019 - 2024. All rights reserved.