android - API 字符串不返回值
问题描述
我正在尝试使用 volley 在 kotlin 中获取 API,但是一旦我尝试从对象中获取字符串,我什么也没有返回:W/System.err: org.json.JSONException: No value for burn
这是 API:
"requested_information": [
{
"level": 1,
"character": "一",
"kana": "いち",
"meaning": "one",
"user_specific": {
"srs": "burned",
"srs_numeric": 9,
"unlocked_date": 1464639834,
"available_date": 0,
"burned": true,
try {
val jsonArray = response.getJSONArray("requested_information")
for (i in 0 until jsonArray.length()) {
val jsonObject = jsonArray.getJSONObject(i)
// Append character to textView here
val cha = jsonObject.getString("character")
val burn = jsonObject.getString("user_specific")
val burn2: Boolean = jsonObject.getBoolean("burned")
解决方案
推荐阅读
- laravel - 你如何在自定义 Laravel Nova 工具中使用确认对话?
- java - Java:字段中的 OpenCSV 转义字符
- php - Laravel dd 辅助函数返回错误 500
- javascript - 如何处理将所有功能移至一项服务的副作用?
- javascript - amcharts4 在对数值轴上处理零值的正确方法
- python - 比较两个列表中的元素并创建一个新列表
- python - 在python中对列表中的文件进行排序
- python - pandas.read_csv(...) 的导入日期时间问题
- amazon-web-services - Dockerrun aws 硬编码内存
- angular - PrimeNG:表格显示问题 - 状态