在发出HTTP get请求后,我返回了一个JSON对象列表,有什么方法可以将这个String转换为JSON对象列表吗?
回复示例:
[{"name":"test","description":"","dbType":"sql server"},
{"name":"test1","description":"","dbType":"sql server"},
{"name":"test2","description":"","dbType":"sql oracle"}]
提前感谢您的帮助!
答案 0 :(得分:0)
简单的json api可以做你想要的,例如
String stringToParse = "[{'name':'test','description':'','dbType':'sql'}, "
+ "{'name':'test1','description':'','dbType':'sql server'},"
+ "{'name':'test2','description':'','dbType':'sql oracle'}]";
JSONParser parser = new JSONParser();
JSONArray json = (JSONArray) parser.parse(stringToParse);
你也可以看看Jackson json api。