【问题标题】:Can't pass a string to get the value of "description" in OpenWeatherMap API JSON无法传递字符串以获取 OpenWeatherMap API JSON 中“描述”的值
【发布时间】:2021-09-08 20:45:46
【问题描述】:

这是API

Check this picture

我想获取“description”的值,但不能传递字符串。

【问题讨论】:

  • 请内联发布您的代码,而不是作为图片链接。

标签: android json api android-studio kotlin


【解决方案1】:

您的weatherObjectjsonArray,因此只能通过索引(即Int)访问。您可能打算将 weatherObject 实例化为jsonObject

val weatherObject = weatherArray.getJSONObject(0)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-22
    • 1970-01-01
    • 1970-01-01
    • 2018-08-22
    相关资源
    最近更新 更多