【问题标题】:JSONKit (in RestKit) converting JSON into NSArrayJSONKit(在 RestKit 中)将 JSON 转换为 NSArray
【发布时间】:2011-08-21 19:47:22
【问题描述】:

我正在使用 RestKit 处理 HTTP 请求,并且通过一些请求,我得到一些总线的 JSON 响应:

[{"bus_number":"1","created_at":"2011-08-15T23:07:52Z","id":1,"model":"Setra","registar_number":"123456","seats":50,"tour_id":1,"updated_at":"2011-08-15T23:07:52Z"},{"bus_number":"2","created_at":"2011-08-15T23:07:52Z","id":2,"model":"Mercedes","registar_number":"2234","seats":60,"tour_id":1,"updated_at":"2011-08-15T23:07:52Z"}]

我正在把它变成方法:

- (void)request:(RKRequest*)request didLoadResponse:(RKResponse*)response {  
    NSLog(@"%@", [response bodyAsString]);
}

因为,我在这个 JSON 中有多个总线,我怎样才能轻松地解析/解码或如何将其转换为 NSArray 或其他东西以便轻松访问元素?

编辑:我需要代码示例如何使用已在 RESTKit 中实现的 JSONKit。

【问题讨论】:

    标签: ios json restkit


    【解决方案1】:

    json-framework 是您可以用来解析 JSON 的众多第三方库之一。

    【讨论】:

    • JSONKit 已经在 RestKit 中实现,这就是为什么我需要 JSONKit 的代码示例
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-29
    • 2016-08-05
    • 2012-02-24
    • 2013-05-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多