0

在将 JSON 数据从 PHP 传递到 Action Scrip 3.0 时,我遇到了几天的麻烦。

因此,我想至少在服务器端转换/解码 JSON 数据,php然后将其作为String动作脚本传递。

无论如何,我的问题是:当我这样做JSON.decode($myJSONdata)时,它只显示NULL. 但是,使用Var_dump实际上显示了所有的 `JSON 数据。

所以,我去了http://jsonlint.com,它给了我一个错误:

Parse error on line 1:
object(stdClass)#5(3
^
Expecting '{', '[' 

知道如何解决这个问题吗?

我的 JSON 数据是(已更新):

{
    "id": 4542471,
    "id_str": "4542471",
    "name": "Sobia Bashir",
    "screen_name": "Sobia",
    "location": "",
    "description": "A woman on the edge!",
    "url": null,
    "entities": {
        "description": {
            "urls": []
        }
    },
    "protected": true,
    "followers_count": 47,
    "friends_count": 61,
    "listed_count": 11,
    "created_at": "Fri Apr 13 21:28:34 +0000 2007",
    "favourites_count": 5,
    "utc_offset": 0,
    "time_zone": "London",
    "geo_enabled": false,
    "verified": false,
    "statuses_count": 729,
    "lang": "en",
    "contributors_enabled": false,
    "is_translator": false,
    "profile_background_color": "1A1B1F",
    "profile_background_image_url": "http://a0.twimg.com/images/themes/theme9/bg.gif",
    "profile_background_image_url_https": "https://si0.twimg.com/images/themes/theme9/bg.gif",
    "profile_background_tile": false,
    "profile_image_url": "http://a0.twimg.com/profile_images/1349587963/Portrait_1_normal.jpg",
    "profile_image_url_https": "https://si0.twimg.com/profile_images/1349587963/Portrait_1_normal.jpg",
    "profile_link_color": "2FC2EF",
    "profile_sidebar_border_color": "181A1E",
    "profile_sidebar_fill_color": "252429",
    "profile_text_color": "666666",
    "profile_use_background_image": true,
    "default_profile": false,
    "default_profile_image": false,
    "following": false,
    "follow_request_sent": false,
    "notifications": false
}
4

1 回答 1

0

使用 Var_dump 实际上显示了所有的 `JSON 数据

var_dump()不产生 JSON,只会产生json_encode()

echo json_encode($myObject);
于 2013-06-17T10:24:29.780 回答