简体   繁体   中英

Convert String of Json object lists to list of JSON objects

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!

Simple json api can do what you want for eg

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM