我有一個JSON
對象,它有一個鍵值對這樣如何字符串轉換爲NSArray的iOS中
"AttachedDocument": "[{\"DocumentId\":354,\"DocumentName\":\"Screenshot_2016-04-15-00-35-11.png\",\"DocumentType\":\"image/png\"}]"
這個值來作爲字符串。我怎麼可以轉換成NSArray
完整的對象
{
"LeaveEntryCode": 0,
"RequestId": 0,
"EmployeeCode": 17186,
"LeaveYear": 2016,
"LeaveTypeCode": 1,
"LeaveReasonCode": 0,
"BaseType": "ess",
"StartDate": "2016-10-24T00:00:00",
"EndDate": "2016-10-24T00:00:00",
"NoOfDays": 1,
"StartDateSession": "full",
"EndDateSession": "full",
"PreApproved": false,
"ForDate": "1901-01-01T00:00:00",
"Remarks": "test from Android",
"CoveringPersonCode": 0,
"AttachedDocument": "[{\"DocumentId\":354,\"DocumentName\":\"Screenshot_2016-04-15-00-35-11.png\",\"DocumentType\":\"image/png\"}]",
"RequestStatus": "P",
"Deleted": false,
"Status": false,
"CreatedBy": 0,
"CreatedDate": "0001-01-01T00:00:00",
"UpdatedBy": 0,
"UpdatedDate": "0001-01-01T00:00:00",
"DeletedBy": 0,
"DeletedDate": "0001-01-01T00:00:00",
"ModuleId": 2,
"ObjectId": 20,
"StartDateString": "10/24/2016",
"EndDateString": "10/24/2016",
"LeaveDayList": [
"10/24/2016-FH,10/24/2016-SH"
],
"SystemLeaveTypeCode": "ANN",
"LeaveTypeName": "ANNUAL",
"Employee": null,
"LieuDayList": null,
"BaseLeaveType": "ANN",
"CoveringPersonName": null,
"LeaveReasonName": "test",
"DocumentSource": "LEAVE"
}
這是一個完整JSON
對象即時得到。我通過網絡服務獲取此信息。
你在哪裏/如何接收?它來自URLRequest嗎?你如何獲得這種格式的字符串? – Fogmeister
這是JSON內的JSON字符串表示。可能的重複[在Objective-C中解析JSON內JSON](http://stackoverflow.com/questions/33149110/parsing-json-within-json-in-objective-c) – Larme