来自Facebook上的Earn Chips Offerwall的回调似乎并不认为以下字符串是有效的JSON:
{"algorithm":"HMAC-SHA256","credits":{"order_details":"{\"order_id\":306370426075228,\"buyer\":501702705,\"app\":124611564308567,\"receiver\":501702705,\"amount\":1,\"update_time\":1326747520,\"time_placed\":1326747519,\"data\":\"\",\"items\":[{\"item_id\":\"0\",\"title\":\"15000000 FullStack Poker Chips\",\"description\":\"Get FullStack Poker Chips\",\"image_url\":\"http:\\\/\\\/external.ak.fbcdn.net\\\/safe_image.php?d=AQBm3ERdBXy3wQO4&url=http\\u00253A\\u00252F\\u00252Fwww.iplaypokerfb.com\\u00252Ffb_graph3\\u00252Fimages\\u00252Ffbc6.jpg\",\"product_url\":\"\",\"price\":1,\"data\":\"{\\\"modified\\\":{\\\"product\\\":\\\"http:\\\\\\\/\\\\\\\/apps.facebook.com\\\\\\\/fullstackpoker_dev\\\\\\\/earn_lander\\\\\\\/earn\\\",\\\"product_title\\\":\\\"FullStack Poker Chips\\\",\\\"product_amount\\\":15000000,\\\"credits_amount\\\":1}}\"}],\"status\":\"placed\"}","status":"placed","order_id":306370426075228,"test_mode":1},"expires":1326751200,"issued_at":1326747520,"oauth_token":"AAABxVWQGiFcBAJWhbUlHq8iRz7YuybEsUh9tUfjdSRbogcentYMEZA60ESLdyVLiX1TjPZBmXk03iFKTpkvr6l1d1IwdCbrpwo13BOCAZDZD","user":{"country":"us","locale":"en_US","age":{"min":21}},"user_id":"501702705"}
但是,当我在在线解析器或验证器中检查它时,它说它是有效的JSON。
我使用的是PHP 5.2.17。我多次使用JSON没有问题。如果有人知道如何在PHP中解析这个问题,请告诉我,因为目前使用Earn Chips Offerwall回调无效。
答案 0 :(得分:2)
JSON完全有效。见http://jsonlint.com/
所以在没有背景的情况下采取猜测:
UTF-8 BOM
。否则请尝试Services_JSON
或upgradephp
中的变体。
答案 1 :(得分:0)
"order_details":"{\"order_id\"
这是不必要的双引号吗?我想这个片段应该是这样的:
"order_details": {"order_id": ...