gpt4 book ai didi

android - org.json.simple.JSONObject 无法转换为 org.json.JSONObject

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:26:30 24 4
gpt4 key购买 nike

当我运行以下代码时...

  JSONObject jsonObject = null;
JSONParser parser=new JSONParser(); // this needs the "json-simple" library

try
{
Object obj = parser.parse(responseBody);
jsonObject=(JSONObject)obj;
}
catch(Exception ex)
{
Log.v("TEST","Exception1: " + ex.getMessage());
}

...在运行时,我在日志输出中看到以下内容:

Exception1: org.json.simple.JSONObject cannot be cast to org.json.JSONObject

我不明白为什么。

最佳答案

您导入了错误的类。变化

import org.json.JSONObject;

import org.json.simple.JSONObject;

关于android - org.json.simple.JSONObject 无法转换为 org.json.JSONObject,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14772764/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com