Take a look at this tutorial. Also you can parse above json like :

JSONArray arr = new JSONArray(yourJSONresponse);
List<String> list = new ArrayList<String>();
for(int i = 0; i < arr.length(); i++){
    list.add(arr.getJSONObject(i).getString("name"));
}
Answer from Saad Asad on Stack Overflow
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ how-to-convert-a-json-array-to-array-using-json-lib-api-in-java
How to convert a JSON array to array using JSON-lib API in Java?\\n
We can convert a JSON array to array by using the toArray() method of JSONArray class. This method produces an Object[] with the contents of JSONArray. ... import java.util.Arrays; import net.sf.json.JSONArray; public class ConvertJSONArrayToArrayTest { public static void main(String[] args) ...
๐ŸŒ
Mkyong
mkyong.com โ€บ home โ€บ java โ€บ how to parse json array with jackson
How to parse JSON Array with Jackson | mkyong.com
April 23, 2024 - package com.mkyong.json.jackson; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import com.mkyong.json.model.Person; import java.util.List; public class JsonArrayToObjectExample { public static void main(String[] args) throws JsonProcessingException { String jsonArray = "[{\"name\":\"mkyong\", \"age\":42}, {\"name\":\"ah pig\", \"age\":20}]"; ObjectMapper mapper = new ObjectMapper(); // 1. convert JSON array to Array objects Person[] person1 = mapper.readValue(jsonArray, Person[].class); for (Person p : person1) { System.out.println(p); } // 2.
๐ŸŒ
Blogger
javarevisited.blogspot.com โ€บ 2013 โ€บ 04 โ€บ convert-json-array-to-string-array-list-java-from.html
How to Convert JSON array to String array in Java - GSon example
This Java example uses the GSON library to create a List of String from JSON array and further Java standard library to convert List to an array. Instead of declaring JSON array in Code, which we did here for demonstration purposes, you can also read input from a file, database, or any URL.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ article โ€บ how-can-we-convert-a-jsonarray-to-string-array-in-java
How can we convert a JSONArray to String Array in Java?
June 6, 2025 - We can convert a JSONArray to String Array by using a simple loop as shown in the example below - import org.json.*; import java.util.*; public class JsonArraytoStringArrayTest { public static void main(String[] args) { JSONArray jsonArray = new JSONArray(); jsonArray.put("INDIA "); jsonArray.put("AUSTRALIA "); jsonArray.put("SOUTH AFRICA "); jsonArray.put("ENGLAND "); jsonArray.put("NEWZEALAND "); List < String > list = new ArrayList < String > (); for (int i = 0; i < jsonArray.length(); i++) { list.add(jsonArray.getString(i)); } System.out.print("JSONArray: " + jsonArray); System.out.print("\n"); String[] stringArray = list.toArray(new String[list.size()]); System.out.print("String Array: "); for (String str: stringArray) { System.out.print(str); } } }
๐ŸŒ
Stack Abuse
stackabuse.com โ€บ converting-json-array-to-a-java-array-or-list
Convert JSON Array to a Java Array or List with Jackson
September 8, 2020 - In this tutorial, we'll use Jackson with Java to convert a JSON array into a Java array and a Java List with examples. This can be done from Strings or Files.
๐ŸŒ
HowToDoInJava
howtodoinjava.com โ€บ home โ€บ gson โ€บ gson โ€“ parse json array to java array or list
Gson - Parse JSON Array to Java Array or List
April 4, 2023 - Gson parses JSON arrays as members without difficulty if they are non-root objects. We can use the fromJson() method in the usual manner and it will parse the JSON array correctly to the required java array or list.
๐ŸŒ
Kode Java
kodejava.org โ€บ how-do-i-convert-array-into-json
How do I convert array into JSON? - Learn Java by Examples
May 31, 2024 - To convert JSON to Array using Jackson library you can do the following: String jsonArray = "[{\"title\":\"Java in Action\"}, {\"title\":\"Spring in Action\"}]"; ObjectMapper objectMapper = new ObjectMapper(); try { Book[] books = objectMapper.readValue(jsonArray, Book[].class); for (Book book : books) { System.out.println(book); } } catch (IOException e) { e.printStackTrace(); } Reply ยท
Find elsewhere
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ java โ€บ how-to-convert-json-array-object-to-java-object
How to Convert JSON Array Object to Java Object? - GeeksforGeeks
July 23, 2025 - In the above code, we have a JSON string jsonString representing an array of user objects. We have created an ObjectMapper instance from the Jackson library, which helps with JSON processing. We have used the readValue() method of the ObjectMapper to convert the JSON string into an array of User objects.
๐ŸŒ
Coderanch
coderanch.com โ€บ t โ€บ 697439 โ€บ java โ€บ convert-JSON-Array-arraylist
how to convert JSON Array to arraylist (Java in General forum at Coderanch)
Here's the JSON Array that i've received : [{"FOODID":"Jus Alpukat","PRICE":"7000","NUM":"1","RES":"7000.0","ORDERID_FK":""},{"FOODID":"Ice Cream","PRICE":"5000","NUM":"10","RES":"50000.0","ORDERID_FK":""}] i need it to be converted into arraylist that will be inserted into JTable into java.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ How-to-convert-JSON-Array-to-normal-Java-Array
How to convert JSON Array to normal Java Array?
February 19, 2020 - import java.util.Arrays; import org.json.JSONArray; public class JsonToArray { public static void main(String args[]) throws Exception { String [] myArray = {"JavaFX", "HBase", "JOGL", "WebGL"}; JSONArray jsArray = new JSONArray(); for (int i = 0; i < myArray.length; i++) { jsArray.put(myArray[i]); ...
๐ŸŒ
Stleary
stleary.github.io โ€บ JSON-java โ€บ org โ€บ json โ€บ JSONArray.html
JSONArray
The internal form is an object having get and opt methods for accessing the values by index, and put methods for adding or replacing values. The values can be any of these types: Boolean, JSONArray, JSONObject, Number, String, or the JSONObject.NULL object. The constructor can convert a JSON text into a Java object. The toString method converts to JSON text.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ java โ€บ how-to-convert-json-array-to-string-array-in-java
How to Convert JSON Array to String Array in Java? - GeeksforGeeks
July 23, 2025 - This will convert our JSON array into a String array. The code has been provided below for reference. ... // importing the packages import java.util.*; import org.json.*; public class GFG { public static void main(String[] args) { // Initialising a JSON example array JSONArray exampleArray = new JSONArray(); // Entering the data into the array exampleArray.put("Geeks "); exampleArray.put("For "); exampleArray.put("Geeks "); // Printing the contents of JSON example array System.out.print("Given JSON array: " + exampleArray); System.out.print("\n"); // Creating example List and adding the data t
๐ŸŒ
CodeSpeedy
codespeedy.com โ€บ home โ€บ how to convert java array to json array?
Convert Java Array to JSON Array Easily- CodeSpeedy
October 27, 2018 - <dependency> <groupId>com.goog... [] normal_array = {"CodeSpeedy", "JSON Array", "Java Array", "Saruque"}; JSONArray json_array= new JSONArray(); for (int i = 0; i < normal_array.length; i++) { json_array.put(normal_array[i]); ...
Top answer
1 of 3
58

for your example:

{'profiles': [{'name':'john', 'age': 44}, {'name':'Alex','age':11}]}

you will have to do something of this effect:

JSONObject myjson = new JSONObject(the_json);
JSONArray the_json_array = myjson.getJSONArray("profiles");

this returns the array object.

Then iterating will be as follows:

    int size = the_json_array.length();
    ArrayList<JSONObject> arrays = new ArrayList<JSONObject>();
    for (int i = 0; i < size; i++) {
        JSONObject another_json_object = the_json_array.getJSONObject(i);
            //Blah blah blah...
            arrays.add(another_json_object);
    }

//Finally
JSONObject[] jsons = new JSONObject[arrays.size()];
arrays.toArray(jsons);

//The end...

You will have to determine if the data is an array (simply checking that charAt(0) starts with [ character).

Hope this helps.

2 of 3
1

You can prefer quick-json parser to meet your requirement...

quick-json parser is very straight forward, flexible, very fast and customizable. Try this out

[quick-json parser] (https://code.google.com/p/quick-json/) - quick-json features -

  • Compliant with JSON specification (RFC4627)

  • High-Performance JSON parser

  • Supports Flexible/Configurable parsing approach

  • Configurable validation of key/value pairs of any JSON Heirarchy

  • Easy to use # Very Less foot print

  • Raises developer friendly and easy to trace exceptions

  • Pluggable Custom Validation support - Keys/Values can be validated by configuring custom validators as and when encountered

  • Validating and Non-Validating parser support

  • Support for two types of configuration (JSON/XML) for using quick-json validating parser

  • Require JDK 1.5 # No dependency on external libraries

  • Support for Json Generation through object serialization

  • Support for collection type selection during parsing process

For e.g.

JsonParserFactory factory=JsonParserFactory.getInstance();
JSONParser parser=factory.newJsonParser();
Map jsonMap=parser.parseJson(jsonString);
๐ŸŒ
javathinking
javathinking.com โ€บ blog โ€บ converting-a-json-simple-array-to-arrayin-java
Converting a JSON Simple Array to an Array in Java โ€” javathinking.com
In Java, an array is a fixed-size collection of elements of the same type. For example, String[] fruits = new String[3]; creates an array of strings with a size of 3. To convert a JSON simple array to a Java array, we need to parse the JSON string.