Ios 解析此输入

Ios 解析此输入,ios,objective-c,xml-parsing,Ios,Objective C,Xml Parsing,我从quizlet API中获取此文本。但是我如何继续导入它并将其切割成可用的部分呢。我试过NSXMLParser,但没用。(错误111) 如何解析此输入 我不需要特别的说明,但是一个关于在哪里搜索的提示会很棒 { "id": 415, "url": "http://quizlet.com/415/us-state-capitals-flash-cards/", "title": "U.S. State Capitals", "created_by": "asuth", "term_count"

我从quizlet API中获取此文本。但是我如何继续导入它并将其切割成可用的部分呢。我试过NSXMLParser,但没用。(错误111)

如何解析此输入

我不需要特别的说明,但是一个关于在哪里搜索的提示会很棒

{
"id": 415,
"url": "http://quizlet.com/415/us-state-capitals-flash-cards/",
"title": "U.S. State Capitals",
"created_by": "asuth",
"term_count": 50,
"created_date": 1144296408,
"modified_date": 1393464052,
"has_images": false,
"subjects": [

],
"visibility": "public",
"editable": "only_me",
"has_access": true,
"description": "",
"lang_terms": "en",
"lang_definitions": "en",
"has_discussion": false,
"creator": {
    "username": "asuth",
    "account_type": "plus",
    "profile_image": "https://fbquizlet-quizletllc.netdna-ssl.com/hprofile-ak-ash1/t5/203061_1030920097_793938339_n.jpg",
    "id": 1
},
],
"terms": [
    {
        "id": 1277349735,
        "term": "Montgomery",
        "definition": "Alabama",
        "image": null
    },
    {
        "id": 842513565,
        "term": "Juneau",
        "definition": "Alaska",
        "image": null
    },
    {
        "id": 413281845,
        "term": "Phoenix",
        "definition": "Arizona",
        "image": null
    },
    {
        "id": 413281846,
        "term": "Little Rock",
        "definition": "Arkansas",
        "image": null
    },
    {
        "id": 413281847,
        "term": "Sacramento",
        "definition": "California",
        "image": null
    },
    {
        "id": 413281848,
        "term": "Denver",
        "definition": "Colorado",
        "image": null
    },
    {
        "id": 413281849,
        "term": "Hartford",
        "definition": "Connecticut",
        "image": null
    },
    {
        "id": 413281850,
        "term": "Dover",
        "definition": "Delaware",
        "image": null
    },
    {
        "id": 413281851,
        "term": "Tallahassee",
        "definition": "Florida",
        "image": null
    },
    {
        "id": 413281852,
        "term": "Atlanta",
        "definition": "Georgia",
        "image": null
    },
    {
        "id": 413281853,
        "term": "Honolulu",
        "definition": "Hawaii",
        "image": null
    },
    {
        "id": 413281854,
        "term": "Boise",
        "definition": "Idaho",
        "image": null
    },
    {
        "id": 413281855,
        "term": "Springfield",
        "definition": "Illinois",
        "image": null
    },
    {
        "id": 413281856,
        "term": "Indianapolis",
        "definition": "Indiana",
        "image": null
    },
    {
        "id": 413281857,
        "term": "Des Moines",
        "definition": "Iowa",
        "image": null
    },
    {
        "id": 413281858,
        "term": "Topeka",
        "definition": "Kansas",
        "image": null
    },
    {
        "id": 413281859,
        "term": "Frankfort",
        "definition": "Kentucky",
        "image": null
    },
    {
        "id": 413281860,
        "term": "Baton Rouge",
        "definition": "Louisiana",
        "image": null
    },
    {
        "id": 413281861,
        "term": "Augusta",
        "definition": "Maine",
        "image": null
    },
    {
        "id": 413281862,
        "term": "Annapolis",
        "definition": "Maryland",
        "image": null
    },
    {
        "id": 413281863,
        "term": "Boston",
        "definition": "Massachusetts",
        "image": null
    },
    {
        "id": 413281864,
        "term": "Lansing",
        "definition": "Michigan",
        "image": null
    },
    {
        "id": 413281865,
        "term": "St. Paul",
        "definition": "Minnesota",
        "image": null
    },
    {
        "id": 413281866,
        "term": "Jackson",
        "definition": "Mississippi",
        "image": null
    },
    {
        "id": 413281867,
        "term": "Jefferson City",
        "definition": "Missouri",
        "image": null
    },
    {
        "id": 413281868,
        "term": "Helena",
        "definition": "Montana",
        "image": null
    },
    {
        "id": 413281869,
        "term": "Lincoln",
        "definition": "Nebraska",
        "image": null
    },
    {
        "id": 413281870,
        "term": "Carson City",
        "definition": "Nevada",
        "image": null
    },
    {
        "id": 413281871,
        "term": "Concord",
        "definition": "New Hampshire",
        "image": null
    },
    {
        "id": 413281872,
        "term": "Trenton",
        "definition": "New Jersey",
        "image": null
    },
    {
        "id": 413281873,
        "term": "Santa Fe",
        "definition": "New Mexico",
        "image": null
    },
    {
        "id": 413281874,
        "term": "Albany",
        "definition": "New York",
        "image": null
    },
    {
        "id": 413281875,
        "term": "Raleigh",
        "definition": "North Carolina",
        "image": null
    },
    {
        "id": 413281876,
        "term": "Bismarck",
        "definition": "North Dakota",
        "image": null
    },
    {
        "id": 413281877,
        "term": "Columbus",
        "definition": "Ohio",
        "image": null
    },
    {
        "id": 413281878,
        "term": "Oklahoma City",
        "definition": "Oklahoma",
        "image": null
    },
    {
        "id": 413281879,
        "term": "Salem",
        "definition": "Oregon",
        "image": null
    },
    {
        "id": 413281880,
        "term": "Harrisburg",
        "definition": "Pennsylvania",
        "image": null
    },
    {
        "id": 413281881,
        "term": "Providence",
        "definition": "Rhode Island",
        "image": null
    },
    {
        "id": 413281882,
        "term": "Columbia",
        "definition": "South Carolina",
        "image": null
    },
    {
        "id": 413281883,
        "term": "Pierre",
        "definition": "South Dakota",
        "image": null
    },
    {
        "id": 413281884,
        "term": "Nashville",
        "definition": "Tennessee",
        "image": null
    },
    {
        "id": 413281885,
        "term": "Austin",
        "definition": "Texas",
        "image": null
    },
    {
        "id": 413281886,
        "term": "Salt Lake City",
        "definition": "Utah",
        "image": null
    },
    {
        "id": 413281887,
        "term": "Montpelier",
        "definition": "Vermont",
        "image": null
    },
    {
        "id": 413281888,
        "term": "Richmond",
        "definition": "Virginia",
        "image": null
    },
    {
        "id": 413281889,
        "term": "Olympia",
        "definition": "Washington",
        "image": null
    },
    {
        "id": 413281890,
        "term": "Charleston",
        "definition": "West Virginia",
        "image": null
    },
    {
        "id": 413281891,
        "term": "Madison",
        "definition": "Wisconsin",
        "image": null
    },
    {
        "id": 413281892,
        "term": "Cheyenne",
        "definition": "Wyoming",
        "image": null
    }
]
}

这是我的“搜索位置提示”:这是json,请在web上查看NSJSONSerialization tuto。

我的假设是,这部分内容就是您想要的:

"terms": [
    {
        "id": 1277349735,
        "term": "Montgomery",
        "definition": "Alabama",
        "image": null
    },
    {
        "id": 842513565,
        "term": "Juneau",
        "definition": "Alaska",
        "image": null
    },
    {
        "id": 413281845,
        "term": "Phoenix",
        "definition": "Arizona",
        "image": null
    },
    {
        "id": 413281846,
        "term": "Little Rock",
        "definition": "Arkansas",
        "image": null
    },
    {
        "id": 413281847,
        "term": "Sacramento",
        "definition": "California",
        "image": null
    },
    {
        "id": 413281848,
        "term": "Denver",
        "definition": "Colorado",
        "image": null
    },
    {
        "id": 413281849,
        "term": "Hartford",
        "definition": "Connecticut",
        "image": null
    },
    {
        "id": 413281850,
        "term": "Dover",
        "definition": "Delaware",
        "image": null
    },
    {
        "id": 413281851,
        "term": "Tallahassee",
        "definition": "Florida",
        "image": null
    },
    {
        "id": 413281852,
        "term": "Atlanta",
        "definition": "Georgia",
        "image": null
    },
    {
        "id": 413281853,
        "term": "Honolulu",
        "definition": "Hawaii",
        "image": null
    },
    {
        "id": 413281854,
        "term": "Boise",
        "definition": "Idaho",
        "image": null
    },
    {
        "id": 413281855,
        "term": "Springfield",
        "definition": "Illinois",
        "image": null
    },
    {
        "id": 413281856,
        "term": "Indianapolis",
        "definition": "Indiana",
        "image": null
    },
    {
        "id": 413281857,
        "term": "Des Moines",
        "definition": "Iowa",
        "image": null
    },
    {
        "id": 413281858,
        "term": "Topeka",
        "definition": "Kansas",
        "image": null
    },
    {
        "id": 413281859,
        "term": "Frankfort",
        "definition": "Kentucky",
        "image": null
    },
    {
        "id": 413281860,
        "term": "Baton Rouge",
        "definition": "Louisiana",
        "image": null
    },
    {
        "id": 413281861,
        "term": "Augusta",
        "definition": "Maine",
        "image": null
    },
    {
        "id": 413281862,
        "term": "Annapolis",
        "definition": "Maryland",
        "image": null
    },
    {
        "id": 413281863,
        "term": "Boston",
        "definition": "Massachusetts",
        "image": null
    },
    {
        "id": 413281864,
        "term": "Lansing",
        "definition": "Michigan",
        "image": null
    },
    {
        "id": 413281865,
        "term": "St. Paul",
        "definition": "Minnesota",
        "image": null
    },
    {
        "id": 413281866,
        "term": "Jackson",
        "definition": "Mississippi",
        "image": null
    },
    {
        "id": 413281867,
        "term": "Jefferson City",
        "definition": "Missouri",
        "image": null
    },
    {
        "id": 413281868,
        "term": "Helena",
        "definition": "Montana",
        "image": null
    },
    {
        "id": 413281869,
        "term": "Lincoln",
        "definition": "Nebraska",
        "image": null
    },
    {
        "id": 413281870,
        "term": "Carson City",
        "definition": "Nevada",
        "image": null
    },
    {
        "id": 413281871,
        "term": "Concord",
        "definition": "New Hampshire",
        "image": null
    },
    {
        "id": 413281872,
        "term": "Trenton",
        "definition": "New Jersey",
        "image": null
    },
    {
        "id": 413281873,
        "term": "Santa Fe",
        "definition": "New Mexico",
        "image": null
    },
    {
        "id": 413281874,
        "term": "Albany",
        "definition": "New York",
        "image": null
    },
    {
        "id": 413281875,
        "term": "Raleigh",
        "definition": "North Carolina",
        "image": null
    },
    {
        "id": 413281876,
        "term": "Bismarck",
        "definition": "North Dakota",
        "image": null
    },
    {
        "id": 413281877,
        "term": "Columbus",
        "definition": "Ohio",
        "image": null
    },
    {
        "id": 413281878,
        "term": "Oklahoma City",
        "definition": "Oklahoma",
        "image": null
    },
    {
        "id": 413281879,
        "term": "Salem",
        "definition": "Oregon",
        "image": null
    },
    {
        "id": 413281880,
        "term": "Harrisburg",
        "definition": "Pennsylvania",
        "image": null
    },
    {
        "id": 413281881,
        "term": "Providence",
        "definition": "Rhode Island",
        "image": null
    },
    {
        "id": 413281882,
        "term": "Columbia",
        "definition": "South Carolina",
        "image": null
    },
    {
        "id": 413281883,
        "term": "Pierre",
        "definition": "South Dakota",
        "image": null
    },
    {
        "id": 413281884,
        "term": "Nashville",
        "definition": "Tennessee",
        "image": null
    },
    {
        "id": 413281885,
        "term": "Austin",
        "definition": "Texas",
        "image": null
    },
    {
        "id": 413281886,
        "term": "Salt Lake City",
        "definition": "Utah",
        "image": null
    },
    {
        "id": 413281887,
        "term": "Montpelier",
        "definition": "Vermont",
        "image": null
    },
    {
        "id": 413281888,
        "term": "Richmond",
        "definition": "Virginia",
        "image": null
    },
    {
        "id": 413281889,
        "term": "Olympia",
        "definition": "Washington",
        "image": null
    },
    {
        "id": 413281890,
        "term": "Charleston",
        "definition": "West Virginia",
        "image": null
    },
    {
        "id": 413281891,
        "term": "Madison",
        "definition": "Wisconsin",
        "image": null
    },
    {
        "id": 413281892,
        "term": "Cheyenne",
        "definition": "Wyoming",
        "image": null
    }
]
您可以使用类似以下内容将其转换为NSDictionary:

NSDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];

其中
data
将是包含JSON的响应。可能需要做一些工作来定制json,以便只获得所需的部分。

这是一个json提要boss。不是XML。