我正在尝试使用java转换解析informatica中的json数据
数据集:
{
"Details": {
"Address": "Other",
"id": "87",
"type": "Commercial",
"Date": "12/07/2016"
}
}
Java代码:
JSONObject json = (JSONObject) JSONSerializer.toJSON(INPUT);
JSONObject details= (JSONObject) json.get("Details");
String Address= details.getString("Address");
AddressOUT=Address;
String Id= details.getString("Id");
IdOUT=Id;
String Type= details.getString("Type");
TypeOUT=Type;
String Date= details.getString("Date");
DateOUT=Date;
外部jar文件: 公地IO-2.4.jar 共享记录-1.2.jar 公地郎2.6.jar 公地的BeanUtils-1.9.2.jar JSON-LIB-2.4-jdk15.jar ezmorph-1.0.6.jar 公地lang3-3.1.jar 公地集合-3.2.1.jar 公地的BeanUtils-1.8.0.jar JSON-lib.jar
导入包:
import java.io.InputStream;
import java.lang.String;
import net.sf.json.JSONObject;
import net.sf.json.JSONArray;
import net.sf.json.JSONSerializer;
我收到以下错误:
Message: [ERROR] net.sf.json.JSONException: Found starting '{' but missing '}' at the end. at character 0 of null
at net.sf.json.util.JSONTokener.syntaxError(JSONTokener.java:499)
at net.sf.json.util.JSONTokener.<init>(JSONTokener.java:85)
at net.sf.json.JSONObject._fromString(JSONObject.java:1201)
at net.sf.json.JSONObject.fromObject(JSONObject.java:165)
at net.sf.json.JSONSerializer.toJSON(JSONSerializer.java:139)
at net.sf.json.JSONSerializer.toJSON(JSONSerializer.java:103)
at net.sf.json.JSONSerializer.toJSON(JSONSerializer.java:84)
at com.informatica.powercenter.server.jtx.JTXPartitionDriverImplGen.execute(JTXPartitionDriverImplGen.java:153) .