【问题标题】:Parsing callback response from Tumblr解析来自 Tumblr 的回调响应
【发布时间】:2014-01-19 17:13:53
【问题描述】:

如何解析 tumblr 响应以检索照片链接、标题等项目。根据 Tumblr API,它是 JSON 格式,但我似乎无法理解如何编码。这里是响应的 sn-p:

{ 
    "blog_name" = myBlogName;
    "can_reply" = 0;
    caption = "<p>pending again</p>";
    date = "2014-01-19 15:54:22 GMT";
    followed = 0;
    format = html;
    highlighted = ();
    id = 73836876344;
    "image_permalink" = "http://bantaybayan.tumblr.com/image/73836876344";
    liked = 0;
    "note_count" = 0;
    photos =         (
                    {
            "alt_sizes" =                 (
                                    {
                    height = 558;
                    url = "http://24.media.tumblr.com/f3fc43d081e3a6366e794b4f94a82d37/tumblr_mzno6mMXgr1tnzku0o1_1280.jpg";
                    width = 740;
                },
                                    {
                    height = 377;
                    url = "http://31.media.tumblr.com/f3fc43d081e3a6366e794b4f94a82d37/tumblr_mzno6mMXgr1tnzku0o1_500.jpg";
                    width = 500;
                },
                                    {
                    height = 302;
                    url = "http://24.media.tumblr.com/f3fc43d081e3a6366e794b4f94a82d37/tumblr_mzno6mMXgr1tnzku0o1_400.jpg";
                    width = 400;
                },
                                    {
                    height = 189;
                    url = "http://25.media.tumblr.com/f3fc43d081e3a6366e794b4f94a82d37/tumblr_mzno6mMXgr1tnzku0o1_250.jpg";
                    width = 250;
                },
                                    {
                    height = 75;
                    url = "http://31.media.tumblr.com/f3fc43d081e3a6366e794b4f94a82d37/tumblr_mzno6mMXgr1tnzku0o1_100.jpg";
                    width = 100;
                },
                                    {
                    height = 75;
                    url = "http://31.media.tumblr.com/f3fc43d081e3a6366e794b4f94a82d37/tumblr_mzno6mMXgr1tnzku0o1_75sq.jpg";
                    width = 75;
                }
            );
            caption = "";
            "original_size" =                 {
                height = 558;
                url = "http://24.media.tumblr.com/f3fc43d081e3a6366e794b4f94a82d37/tumblr_mzno6mMXgr1tnzku0o1_1280.jpg";
                width = 740;
            };
        }
    );
    "post_url" = "http://bantaybayan.tumblr.com/post/73836876344/pending-again";
    "reblog_key" = LUOtTeAe;
    "short_url" = "http://tmblr.co/Z89Zxo14n1L8u";
    slug = "pending-again";
    state = published;
    tags =         (
    );
    timestamp = 1390146862;
    type = photo;
}

提前致谢

【问题讨论】:

    标签: objective-c json callback response tumblr


    【解决方案1】:

    首先,这看起来不像 JSON。使用像JSONLint这样的验证器进行检查

    如果您对 JSON 数据使用编辑器会更容易。有很多免费的在线服务http://jsoneditoronline.org/

    对于 Objective-C,这个 SO 问题可能会对您有所帮助:Parsing JSON using Objective-C

    【讨论】:

      猜你喜欢
      • 2021-04-27
      • 2015-02-26
      • 1970-01-01
      • 1970-01-01
      • 2011-10-23
      • 2020-01-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多