JSON需要一个8字符数字的字符串,如何用引号括起来

时间:2012-11-09 06:20:39

标签: php json

我有以下json,由于下面的json它无效,我需要使它成为一个字符串才能在jsonically有效。关于在php中执行此操作的最佳方法的任何建议?

{
    29646191: [
        "https://www.facebook.com/RobertScoble/posts/480030845352725",
        "https://sphotos-a.xx.fbcdn.net/hphotos-prn1/s480x480/546943_10151235934049655_1771118951_n.jpg",
        "Today I tried... | Facebook",
        "Robert Scoble wrote: Today I tried something. I paid $49 and... Join Facebook to connect with Robert Scoble and others you may know.",
        null,
        [
            "//images3-focus-opensocial.googleusercontent.com/gadgets/proxy?url\u003dhttps://sphotos-a.xx.fbcdn.net/hphotos-prn1/s480x480/546943_10151235934049655_1771118951_n.jpg\u0026container\u003dfocus\u0026gadget\u003da\u0026rewriteMime\u003dimage/*\u0026refresh\u003d31536000\u0026resize_h\u003d150\u0026resize_w\u003d150\u0026no_expand\u003d1",
            150,
            150,
            null,
            null,
            null,
            null,
            null,
            [
                3,
                "https://images1-focus-opensocial.googleusercontent.com/gadgets/proxy?url\u003dhttps://sphotos-a.xx.fbcdn.net/hphotos-prn1/s480x480/546943_10151235934049655_1771118951_n.jpg\u0026container\u003dfocus\u0026gadget\u003dhttps://plus.google.com\u0026rewriteMime\u003dimage/*\u0026resize_h\u003d800\u0026resize_w\u003d800\u0026no_expand\u003d1"
            ]
        ],
        "//s2.googleusercontent.com/s2/favicons?domain\u003dwww.facebook.com",
        [],
        null,
        []
    ]
}

1 个答案:

答案 0 :(得分:1)

让浏览器为您完成。

var x = {
    29646191: [
        "https://www.facebook.com/RobertScoble/posts/480030845352725",
        "https://sphotos-a.xx.fbcdn.net/hphotos-prn1/s480x480/546943_10151235934049655_1771118951_n.jpg",
        "Today I tried... | Facebook",
        "Robert Scoble wrote: Today I tried something. I paid $49 and... Join Facebook to connect with Robert Scoble and others you may know.",
        null,
        [
            "//images3-focus-opensocial.googleusercontent.com/gadgets/proxy?url\u003dhttps://sphotos-a.xx.fbcdn.net/hphotos-prn1/s480x480/546943_10151235934049655_1771118951_n.jpg\u0026container\u003dfocus\u0026gadget\u003da\u0026rewriteMime\u003dimage/*\u0026refresh\u003d31536000\u0026resize_h\u003d150\u0026resize_w\u003d150\u0026no_expand\u003d1",
            150,
            150,
            null,
            null,
            null,
            null,
            null,
            [
                3,
                "https://images1-focus-opensocial.googleusercontent.com/gadgets/proxy?url\u003dhttps://sphotos-a.xx.fbcdn.net/hphotos-prn1/s480x480/546943_10151235934049655_1771118951_n.jpg\u0026container\u003dfocus\u0026gadget\u003dhttps://plus.google.com\u0026rewriteMime\u003dimage/*\u0026resize_h\u003d800\u0026resize_w\u003d800\u0026no_expand\u003d1"
            ]
        ],
        "//s2.googleusercontent.com/s2/favicons?domain\u003dwww.facebook.com",
        [],
        null,
        []
    ]
}

JSON.stringify(x);

给出

  

“{” 29646191 “:[” https://www.facebook.com/RobertScoble/posts/480030845352725" ,“https://sphotos-a.xx.fbcdn.net/hphotos-prn1/s480x480/546943_10151235934049655_1771118951_n .JPG “” 今天   我试过...... | Facebook“,”Robert Scoble写道:今天我尝试了一些东西。   我支付了49美元并且......加入Facebook与Robert Scoble和   其他你可能   知道 “空,[” //images3-focus-opensocial.googleusercontent.com/gadgets/proxy?url=https://sphotos-a.xx.fbcdn.net/hphotos-prn1/s480x480/546943_10151235934049655_1771118951_n.jpg&。容器=焦点&安培;小工具= A和rewriteMime =图像/ *&安培;刷新= 31536000&安培; resize_h = 150安培; resize_w = 150安培; NO_EXPAND = 1" ,150150,NULL,NULL,NULL,NULL,NULL,[3“,HTTPS: //images1-focus-opensocial.googleusercontent.com/gadgets/proxy?url=https://sphotos-a.xx.fbcdn.net/hphotos-prn1/s480x480/546943_10151235934049655_1771118951_n.jpg&container=focus&gadget=https: //plus.google.com&rewriteMime=image/*&resize_h=800&resize_w=800&no_expand=1"]],"//s2.googleusercontent.com/s2/favicons?domain=www.facebook.com “[],NULL,[]]}”