Java JSONValue无法转换为JSONObject

Java JSONValue无法转换为JSONObject,java,json,jsonobject,Java,Json,Jsonobject,我对Java相当陌生,我正在尝试为我的JSON文件编写一个迭代器。 但它一直告诉我,jsonobjectauthornode=(JSONObject)authors.next()处的“不兼容类型:JSONValue无法转换为JSONObject” import java.util.Iterator; 导入org.json.simple.JSONArray; 导入org.json.simple.JSONObject; 导入org.json.simple.JSONValue; 导入mende.ent

我对Java相当陌生,我正在尝试为我的JSON文件编写一个迭代器。 但它一直告诉我,
jsonobjectauthornode=(JSONObject)authors.next()处的“不兼容类型:JSONValue无法转换为JSONObject”

import java.util.Iterator;
导入org.json.simple.JSONArray;
导入org.json.simple.JSONObject;
导入org.json.simple.JSONValue;
导入mende.entity.Author;
公共类JSoniratorAuthor实现迭代器{
私有迭代器作者;
公共JSONIteratorAuthor(JSONObject JSONObject){
this.authors=((JSONArray)jsonObject.get(“authors”).iterator();
}
@凌驾
公共布尔hasNext(){
返回this.authors.hasNext();
}
公共作者next(){
if(this.hasNext()){
作者a=新作者();
JSONObject authorNode=(JSONObject)authors.next();
a、 setFirstName((字符串)authorNode.get(“first_name”);
a、 setLastName((字符串)authorNode.get(“姓氏”);
返回a;
}
否则{
返回null;
}
}    
}
有人能帮我吗?

作者。下一步();返回JSONValue类型的对象

private Iterator<JSONValue> authors;
我想你的
迭代器应该是
迭代器

private Iterator<JSONValue> authors;
JSONObject authorNode = (JSONObject) authors.next();