我正在实施Google Place服务。当我检索json对象时,我意识到json对象(opening_hours)中缺少数组。下面是检索对象的示例。有谁知道为什么缺少某些字段?
Hi, i referred to your answers and find a place which has opening hours in google maps but still does not exist in the json object. Below is the example.
[{
"html_attributions": \[
"Listings by <a href=\"http://www.openrice.com/\">OpenRice</a>"
\],
"results": \[
{
"formatted_address": "30 Raffles Ave, Singapore 039803",
"geometry": {
"location": {
"lat": 1.2892988,
"lng": 103.8631368
}
},
"icon": "https://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
"id": "021245e36680793a72b3c428607f0a01ed5d1786",
"name": "Singapore Flyer",
"opening_hours": {
"open_now": true,
"weekday_text": \[\]
},
"photos": \[
{
"height": 2048,
"html_attributions": \[
"<a href=\"https://maps.google.com/maps/contrib/115338279981022433314/photos\">David Montasco</a>"
\],
"photo_reference": "CmRdAAAAWbq-OmrKkZ0Rz9JyDVrnnMjD760XaCdEPBOYLITUhfUCcr6N4YmsMUxyou5yWnMQs4_iQhQc04cR4WOrDuqR5a43ZaH5O5zv4O783lXZP4qDosm-bnUUmyCOV7pNH76LEhBgl4L5ScAvva4b4TkM7-UGGhTmUVujviiDHGICoITSZr5JKJFgQA",
"width": 1367
}
\],
"place_id": "ChIJzVHFNqkZ2jERboLN2YrltH8",
"rating": 4.3,
"reference": "CnRiAAAACBop0imOgmYxPrAp_4b6CIgkGMeaaWb6oL-RsoOK6CxElf7-yNPBz_q5qXVpTfVpsmtWDua6r7gEZdsi9420icrp-mnpG6HLiGmmHupluWkUmuRCdwQ8BRlPW_HYAP9qEblbZMoAbvBDGMZgk_QyoRIQtPeJRN6-_Nm66jH-OMsCBBoUkZDaSDMQqEyPpCOyysU6ulgZtA8",
"types": \[
"establishment"
\]
}
\],
"status": "OK"
}][1]
答案 0 :(得分:1)
根据Google Places documentation:
不会返回未在Google商家信息数据库中指定营业时间的地点。
这意味着在返回此参数之前,某个地方必须向Google注册其营业时间。我看到你在寻找巴黎的协和广场。当我正常搜索Google时,他们的小时数不会显示在侧边栏Google地址窗口小部件中。这意味着他们尚未在Google上注册营业时间,因此该数据将从Google商家信息的任何请求中排除。如果您请求已向Google注册该信息的地方,您应该获取该数据。
答案 1 :(得分:0)
Google没有此地点的营业时间,因此预计Google Places API中没有opening_hours
字段。如果您在Google地图上查看此地点,您将无法看到其中显示的营业时间:https://maps.google.com/?cid=1730241942096554796
The documentation表示结果可能包含以下字段(包括opening_hours
同样,许多其他字段(例如rating
或price_level
)可能(通常也)不存在。