public class Test {
public static void main(String[] args) throws ClientProtocolException, IOException {
HttpClient client = new DefaultHttpClient();
JSONObject json = new JSONObject();
json.put('set_boot' : True);
json.put('synchronous': True),
json.put('filters',filterList);
List filterList = new ArrayList();
filterList.put(6005076802818994A0000000000009DD);
json.put('volumes':volumeList);
List volumeList = new ArrayList();
volumeList.add('*all');
json.add('allow_unsupported': True);
StringEntity se = new StringEntity(json.toString());
System.out.println(se);
}
}
我试图添加值转换成JSON的查询,如:无效字符常量JSON
{
'set_boot': True,
'synchronous': True,
'filters': {
'host_refs': [u '6005076802818994A0000000000009DD']
},
'volumes': ['*all'],
'allow_unsupported': True
}
但是Eclipse是给我的错误无效字符常量 上线
json.put('set_boot' : True);
我已经试过写了一些其他的词也像
json.put('set' : True);
但它仍然给我同样的错误。
'true',not'True'。 ;) –
为什么'真'而不是'真'?我看到你在创建它们之前就添加了很多对象。这看起来不正确。 – wxyz
这是什么语言?因为它不是有效的Java ... –