Reputation: 15
After making a HTTP get request i'm returned with a list of JSON objects, is there any way in which I can convert this String into a list of JSON objects??
Example response:
[{"name":"test","description":"","dbType":"sql server"},
{"name":"test1","description":"","dbType":"sql server"},
{"name":"test2","description":"","dbType":"sql oracle"}]
Thank you in advance for any help!
Upvotes: 0
Views: 1327
Reputation: 430
Simple json api can do what you want for e.g
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);
You can also look into Jackson json api.
Upvotes: 1