Google Maps返回https://jsonlint.com/标记为无效JSON的内容。人们留下的评论中的转义单引号存在问题。像这样:
{
"author_name": "Darrell McClendon",
"author_url": "https://www.google.com/maps/contrib/105899976805332994558/reviews",
"language": "en",
"profile_photo_url": "https://lh4.googleusercontent.com/-XmJwNWWFIfM/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3rfAh9eFXs0wNVHCkZgXEc5k2MwXsg/s128-c0x00000000-cc-rp-mo-ba3/photo.jpg",
"rating": 4,
"relative_time_description": "10 months ago",
"text": "Not hard to get here. From I-10 w, turn right into Central Ave. Turn right onto 12th st, and park by the first gate on right. You check in there, but then drive thru the 2nd gate. Can\'t stay in the truck while unloading",
"time": 1528824337
}
...是一个问题(请参阅“文本”值)。在此运行json_decode会返回null。
这通常是个问题吗?直到今天早上,我在使用当前应用程序时都没有遇到过,尽管上周使用相同的位置进行了测试。我可以确认我已经记录了相同请求的结果,并且其中不包含转义的单引号,这就是为什么当时解码正常的原因。