在使用Json-Lib时,为什么我在尝试将XML-string序列化为JSON-string时一直收到此消息。
代码如下:
String jsonString = "<o><bool type=\"boolean\">true</bool>" +
"<int type=\"number\">1</int>" +
"<name type=\"string\">json</name></o>";
XMLSerializer xml = new XMLSerializer();
JSONObject jobject = (JSONObject) xml.read(jsonString);
System.out.println(jobject.toString(2));输出为:
Sep 19, 2011 4:03:46 PM net.sf.json.xml.XMLSerializer getType
INFO: Using default type string
{
"bool": true,
"int": 1,
"name": "json"
}为什么我会收到此“INFO: Using default...”消息?还有,我怎么才能摆脱它呢?
发布于 2011-09-19 06:15:49
您会收到该消息,因为您的顶级元素o没有类型。这只是一条信息消息,所以你可以忽略它。如果您更改了:
<o>至:
<o type="object">它应该会消失。但是,这也无关紧要。
https://stackoverflow.com/questions/7463348
复制相似问题