可能重复:
JSONkit 排序问题
我有以下json
[
{
"Pending": 67,
"Past Due": 63,
"Invites": 0
},
{
"Reading Approval": 4,
"Schedule Approval": 16,
"Session Assignment": 1
},
{
"Reading Approval": 3,
"Schedule Approval": 20,
"Class Approval": 20,
"Module Approval": 2,
"Training Plan Review": 2,
"Job Confirmation": 1
}
]
当我将 json 字符串分配给 nsarray 时,字典中的值会按字母顺序排序。
NSArray *arr = [strResult JSONValue];
如何保持与 json 字符串相同的顺序?
arr =
{
Invites = 0;
"Past Due" = 63;
Pending = 67;
},
{
"Reading Approval" = 4;
"Schedule Approval" = 16;
"Session Assignment" = 1;
},
{
"Class Approval" = 20;
"Job Confirmation" = 1;
"Module Approval" = 2;
"Reading Approval" = 3;
"Schedule Approval" = 20;
"Training Plan Review" = 2;
}
)
这是我要显示的表格:
Group 1
Pending 67
Past Due 63
Invites 0
Group 2
Reading Approval 4
Schedule Approval 16
Session Assignment 1
Group 3
Reading Approval 3
Schedule Approval 20
Class Approval 20
Module Approval 2
Training Plan Review 2
Job Confirmation 1