0

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!

4
  • If you are talking about getting JSON to browser client side, you could use javascript's: JSON.parse(jsonstringvar) Commented Nov 17, 2017 at 10:49
  • In Java you can use Jackson Fasterxml Api , and incase of client side as @MRsa mentioned you can use Javascripts Json.parse Commented Nov 17, 2017 at 10:51
  • @MRsa Hi thanks, but the end goal after converting the string is to extract values from the JSON objects in Java Commented Nov 17, 2017 at 10:52
  • @RahulRabhadiya Okay thanks i'll have a look! Commented Nov 17, 2017 at 15:47

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.