简体   繁体   English

“ Google地方信息” API中可以保证哪些JSON标签?

[英]which JSON tags are guaranteed in the “Google Places” API?

Is there a list of JSON objects that will certainly be present when working with the Google Places API service? 使用Google Places API服务时,是否肯定会存在JSON对象列表? I assume "geometry" , "location", and "name" will always be returned in the JSON page, but I just found out the hard way that "opening_hours" is only present for certain locations. 我假设“ geometry”,“ location”和“ name”将始终在JSON页面中返回,但是我发现很难在“ opening_hours”仅出现在某些位置的情况。 I need to add extra try catch blocks for entries that are not guaranteed to be present. 我需要为不保证存在的条目添加额外的try catch块。 Anyone have info on which entries are or aren't guaranteed? 有人知道哪些条目可以保证或不能保证吗?

I just fixed a bug in my android app that was caused because I was trying to call an object that was only present for some (but not all) of the entries in the Google Places API. 我刚刚修复了我的android应用中的一个错误,该错误是由于我试图调用一个仅在Google Places API中的某些(但不是全部)条目中存在的对象而引起的。 Would rather not add extra try catches where I don't need them... 宁愿不在我不需要的地方添加额外的尝试捕获...

None of the results in the results array are guaranteed to be returned as mentioned in the documentation : 没有保证按照文档所述返回results数组中的任何results

"Each result within the results array may contain the following fields" “结果数组中的每个结果可能包含以下字段”

However, all the parameters except opening_hours , events[] and rating should be returned. 但是, 应该返回除opening_hoursevents[]rating以外的所有参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM