使用 Google Places API 服务时是否存在一定会出现的 JSON 对象列表?我假设“geometry”、“location”和“name”将始终在 JSON 页面中返回,但我刚刚发现“opening_hours”仅在某些位置存在。我需要为不保证存在的条目添加额外的 try catch block 。有人知道哪些参赛作品有保证或没有保证吗?
我刚刚修复了 Android 应用程序中的一个错误,该错误是因为我试图调用仅针对 Google Places API 中的某些(但不是全部)条目存在的对象而引起的。宁愿不在不需要的地方添加额外的 try catch...
最佳答案
如 documentation 中所述,不能保证返回 results
数组中的任何结果。 :
"Each result within the results array may contain the following fields"
但是,除了 opening_hours
、events[]
和 rating
之外的所有参数都应该返回。 p>
关于java - "Google Places"API 中保证了哪些 JSON 标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13124981/