ArrayList<String> list = new ArrayList<String>();     
JSONArray jsonArray = (JSONArray)jsonObject; 
if (jsonArray != null) { 
   int len = jsonArray.length();
   for (int i=0;i<len;i++){ 
    list.add(jsonArray.get(i).toString());
   } 
} 
Answer from Pentium10 on Stack Overflow
🌐
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 - Learn to use Google GSON library to deserialize or convert JSON, containing JSON array as root or member, to Java Array or List of objects.
🌐
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) ...
Discussions

android - Convert Json Array to normal Java list - Stack Overflow
Is there a way to convert JSON Array to normal Java Array for android ListView data binding? More on stackoverflow.com
🌐 stackoverflow.com
java - How to parse a JSON and turn its values into an Array? - Stack Overflow
Don't worry Jonathon...JSONObject ... in java. What alex put was just example.... ... I gave you a point for providing simple code for me to parse my json string. ... Save this answer. ... Show activity on this post. ... JSONObject myjson = new JSONObject(the_json); JSONArray the_json_array = ... More on stackoverflow.com
🌐 stackoverflow.com
java - Convert JSONArray to String Array - Stack Overflow
So, this is in order to get a json array to a String[] using jsonsimple. According to the (marvelous) decode examples and docs, JSONArrays are java List, so we can access List methods. More on stackoverflow.com
🌐 stackoverflow.com
How to turn json objects into an array of json objects using Java?
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://imgur.com/a/fgoFFis ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
🌐 r/javahelp
7
4
June 28, 2022
🌐
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
Java programming tutorial to convert JSON array to String array with example, by using Gson library. Though you can also use other open source library, Gson seems easy to me.
🌐
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 - Using Jackson's ObjectMapper class, it's easy to read values and map them to an object, or an array of objects. We just use the readValue() method, passing the JSON contents and the class we'd like to map to.
🌐
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.
🌐
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]); } System.out.println(jsArray); String[] array = new String[myArray.length]; for (int i = 0; i < myArray.length; i++) { array[i] = (String)jsArray.get(i); } System.out.println("Contents of the array :: "+Arrays.toString(array)); } } ["JavaFX","HBase","JOGL","WebGL"] Contents of the array :: [JavaFX, HBase, JOGL, WebGL] Ramu Prasad Β·
Find elsewhere
🌐
Stleary
stleary.github.io β€Ί JSON-java β€Ί org β€Ί json β€Ί JSONArray.html
JSONArray
Put or replace an object value in the JSONArray. If the index is greater than the length of the JSONArray, then null elements will be added as necessary to pad it out. ... value - The value to put into the array.
🌐
CodeSpeedy
codespeedy.com β€Ί home β€Ί how to convert json array to normal java array easily
Convert JSON array to normal Java Array easily - CodeSpeedy
October 14, 2018 - Learn how to convert JSON array to normal Java Array easily. You can use both array and arraylist here. Learn with proper example.
🌐
Mkyong
mkyong.com β€Ί home β€Ί java β€Ί how to parse json array with jackson
How to parse JSON Array with Jackson | mkyong.com
April 23, 2024 - In Jackson, we can convert the JSON array to an Array or List. ... 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.
🌐
Java Code Geeks
javacodegeeks.com β€Ί home β€Ί core java
Converting a JSON Object to a JSON Array in Java - Java Code Geeks
August 1, 2025 - To convert this object into a JSON array, the code first transforms the JSONObject into a Map using toMap(), then extracts only the values from that map using values(), and wraps those values in a new JSONArray.
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);
🌐
TutorialsPoint
tutorialspoint.com β€Ί How-to-convert-Java-Array-Collection-to-JSON-array
How to convert Java Array/Collection to JSON array?
<dependency> <groupId>com.googlecode.json-simple</groupId> <artifactId>json-simple</artifactId> <version>1.1</version> </dependency> The JSONArray class of the org.json package provides put() method. Using this method, you can populate the JSONArray object with the contents of the elements. ...
🌐
Coderanch
coderanch.com β€Ί t β€Ί 697439 β€Ί java β€Ί convert-JSON-Array-arraylist
how to convert JSON Array to arraylist (Java in General forum at Coderanch)
I've read about GSON and a few article to do this but i still don't understand. Can you give me example how to do this? thanks. Hi Melody, You can use jackson library to convert json object to arraylist, first, you need to create a POJO second , create a method that convert to ArrayList Object, ...
🌐
BeginnersBook
beginnersbook.com β€Ί 2024 β€Ί 06 β€Ί convert-json-array-to-arraylist-in-java
Convert JSON Array to ArrayList in Java
June 13, 2024 - 2. Parse the JSON Array and Convert ... \"age\":37}, {\"name\":\"Rahul\", \"age\":34}]"; // Convert JSON array to JSONArray JSONArray jsonArray = new JSONArray(jsonArrayString); // Convert JSONArray to ArrayList ArrayList<JSONObject> arrayList = new ArrayList<>(); for (int ...
🌐
Reddit
reddit.com β€Ί r/javahelp β€Ί how to turn json objects into an array of json objects using java?
r/javahelp on Reddit: How to turn json objects into an array of json objects using Java?
June 28, 2022 -

Hi. I'm new to java and stuck wondering how I would go about turning something like this: {} {} {} into this: [{},{},{}]. I'm trying to figure out how to do this to my incoming json data using Java. The data has like 20 similar objects, with the same keys but with constantly changing values.

Any help is much appreciated.

Sincerely,

your friendly neighborhood noob

Top answer
1 of 2
4
Look into Collections. you can use a List with List.of(obj1, obj2,...), The return here is going to be immutable and serializable, alternatively Arrays.asList({obj1, obj2,...}). Again, check out java.util.collections for more details
2 of 2
1
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://imgur.com/a/fgoFFis ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
🌐
CodeSpeedy
codespeedy.com β€Ί home β€Ί how to convert java array to json array?
Convert Java Array to JSON Array Easily- CodeSpeedy
October 27, 2018 - In order to add this library to your project, you will need to create a maven dependency. <dependency> <groupId>com.googlecode.json-simple</groupId> <artifactId>json-simple</artifactId> <version>1.1</version> </dependency> ... import org.json.JSONArray; public class MyClass { public static void main(String[] args) { String [] 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]); } System.out.println(json_array); } }
🌐
javathinking
javathinking.com β€Ί blog β€Ί converting-a-json-simple-array-to-arrayin-java
Converting a JSON Simple Array to an Array in Java β€” javathinking.com
Java provides several libraries for JSON parsing, such as Jackson, Gson, and JSON-simple. Data Exchange: When communicating with a RESTful API, the API might return a JSON simple array. You need to convert it to a Java array for further processing in your Java application.
🌐
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 - JavaScript. They can be understood as a collection of data (strings, numbers, booleans) in an indexed manner. Given a JSON array, we will discuss how to convert it into a String array in Java.