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
🌐
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.
Discussions

java - JSONArray to string array - Stack Overflow
NOTE 1: JsonArray must be an array of strings, for the above example, without any property names. More on stackoverflow.com
🌐 stackoverflow.com
java - Converting from JSONArray to String then back again - Stack Overflow
I need to store a JSONArray object as a string then retrieve the string and convert it back to a JSONArray. More on stackoverflow.com
🌐 stackoverflow.com
android - JSONArray to String in java - Stack Overflow
Your bigger problem is that your JSONArray is not being constructed properly. You're supposed to add other JSONArrays and JSONObjects to it, but you're adding other objects. They are implicitly being turned into Strings. You need to convert them to JSON before putting them into your array. More on stackoverflow.com
🌐 stackoverflow.com
jquery - Convert JSONArray to String Array with custom format - Stack Overflow
I want to ask a question about converting a jsonArray to a StringArray on android. More on stackoverflow.com
🌐 stackoverflow.com
November 4, 2017
🌐
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 - 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); } } }
🌐
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 - Here, we will use some example data to input into the array, but you can use the data as per your requirements. 1. Defining the array · JSONArray exampleArray = new JSONArray(); Note that we will import the org.json package in order to use ...
🌐
YouTube
youtube.com › watch
Json Array To String - YouTube
In this video i have showed how to convert json array element to string( with list of array elements with comma separated).
Published: July 12, 2019
🌐
Stleary
stleary.github.io › JSON-java › org › json › JSONArray.html
JSONArray
JSONException - If the key is not found or if the value cannot be converted to a number. public String getString(int index) throws JSONException · Get the string associated with an index. ... A string value. ... JSONException - If there is no string value for the index. ... Determine if the value is null. ... Make a string from the contents of this JSONArray. The separator string is inserted between each element. Warning: This method assumes that the data structure is acyclical. ... JSONException - If the array contains an invalid number.
Find elsewhere
🌐
Oracle
docs.oracle.com › javaee › 7 › api › javax › json › JsonArray.html
JsonArray (Java(TM) EE 7 Specification APIs)
JsonArray provides various accessor methods to access the values in an array. The following example shows how to obtain the home phone number "212 555-1234" from the array built in the previous example: JsonObject home = array.getJsonObject(0); String number = home.getString("number");
🌐
Quora
quora.com › How-do-you-convert-a-JSON-object-into-a-String-Array
How to convert a JSON object into a String Array - Quora
Answer: It kind of depends on what you intend on doing with the json object, and possibly what the json object contains. A using object is a linefeed delimited string. It may contain an array as one of its members. So if the intent is to store the entire json object as an array of strings, start...
Top answer
1 of 6
2

The problem is not the JSONArray.toString(), as @Selvin mentioned.

From JSONArray source:

/**
 * Encodes this array as a compact JSON string, such as:
 * <pre>[94043,90210]</pre>
 */
@Override public String toString() {
    try {
        JSONStringer stringer = new JSONStringer();
        writeTo(stringer);
        return stringer.toString();
    } catch (JSONException e) {
        return null;
    }
}

/**
 * Encodes this array as a human readable JSON string for debugging, such
 * as:
 * <pre>
 * [
 *     94043,
 *     90210
 * ]</pre>
 *
 * @param indentSpaces the number of spaces to indent for each level of
 *     nesting.
 */
public String toString(int indentSpaces) throws JSONException {
    JSONStringer stringer = new JSONStringer(indentSpaces);
    writeTo(stringer);
    return stringer.toString();
}

The problem is that you need to convert your ChecklistAnswer to JSON object first for your JSONArray to work properly.

Again from Javadoc:

/**
 * A dense indexed sequence of values. Values may be any mix of
 * {@link JSONObject JSONObjects}, other {@link JSONArray JSONArrays}, Strings,
 * Booleans, Integers, Longs, Doubles, {@code null} or {@link JSONObject#NULL}.
 * Values may not be {@link Double#isNaN() NaNs}, {@link Double#isInfinite()
 * infinities}, or of any type not listed here.

...

2 of 6
1

In my ChecklistAnwer class i added:

   public JSONObject toJsonObject(){
    JSONObject json = new JSONObject();

    try {
        json.put("questionId", questionId);
        json.put("checklistId", checklistId);
        json.put("answer", answer);
        json.put("remark", remark);
    } catch (JSONException e) {
        e.printStackTrace();
    }

    return json;
}

and in my other class:

JSONArray answers = new JSONArray();

ChecklistAnswer answer = new ChecklistAnswer(questions.get(id).id, 2, cb.isChecked(),         text.getText().toString());

answers.put(answer.toJsonObject());

if i filled the array:

String js = answers.toString(1);

and that returns:

[
 {
  "answer": true,
  "questionId": 1,
  "remark": "",
  "checklistId": 2
 },
 {
  "answer": false,
  "questionId": 4,
  "remark": "teesxfgtfghyfj",
  "checklistId": 2
 },
 {
  "answer": true,
  "questionId": 4,
  "remark": "",
  "checklistId": 2
 },
 {
  "answer": true,
  "questionId": 4,
  "remark": "",
  "checklistId": 2
 },
 {
  "answer": true,
  "questionId": 4,
  "remark": "",
  "checklistId": 2
 },
 {
  "answer": true,
  "questionId": 4,
  "remark": "",
  "checklistId": 2
 },
 {
  "answer": true,
  "questionId": 4,
  "remark": "",
  "checklistId": 2
 }
]

thanks to @Selvin

🌐
YouTube
youtube.com › hey delphi
Android : Convert JSONArray to String Array - YouTube
Android : Convert JSONArray to String ArrayTo Access My Live Chat Page, On Google, Search for "hows tech developer connect"I have a hidden feature that I pro...
Published: May 12, 2023
Views: 1
🌐
Stack Overflow
stackoverflow.com › questions › 47107615 › convert-jsonarray-to-string-array-with-custom-format
jquery - Convert JSONArray to String Array with custom format - Stack Overflow
November 4, 2017 - Here is my code to get jsonArray · 0:{Value: "0", Display: "w"} 1:{Value: "22", Display: "1w"} 2:{Value: "30", Display: "w2"} 3:{Value: "45", Display: "w3"} ... cols = [ { Id: 'combo', Values: [ { "Value": "0", "Display": "w" }, { "Value": "22","Display": "1w" }, { "Value": "30", "Display": "w2" }, { "Value": "45", "Display": "w3" } ], }, ] var jsonString = JSON.stringify(cols.Values).replace("]", "").replace("[", "").replace("},{", "");
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › api › org.json.jsonarray.tostring
JSONArray.ToString(Int32) Method (Org.Json) | Microsoft Learn
[<Android.Runtime.Register("toString", "(I)Ljava/lang/String;", "GetToString_IHandler")>] override this.ToString : int -> string ... Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
🌐
EDUCBA
educba.com › home › software development › software development tutorials › javascript tutorial › json array of strings
JSON Array of Strings | How JSON Array of String Works? (Examples)
April 14, 2023 - We have seen how JSON array represents an ordered list of values be it string, numbers, Boolean, or an object. Here as per the topic, we have discussed how array of strings are accessed using for loop, how array value can be deleted, multi dimensional array, a nested array with examples listed above for each.
Address: Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
Make Community
community.make.com › questions
Convert json array to string - Questions - Make Community
February 17, 2024 - I’m building AI chatbots and having a hard time converting the LLM response into a message that I can send. The LLM API response is inside an array with each word is a separate item. From what I understand this allows s…
🌐
W3Schools
w3schools.com › js › js_json_server.asp
<h1>JavaScript Loading JSON</h1>
JSON is often stored in files or returned by calls to web servers.
🌐
Reddit
reddit.com › r/powerplatform › powerautomate: json array to string back to array. json() returns only first entry
r/PowerPlatform on Reddit: PowerAutomate: Json Array to String back to array. JSON() returns only first entry
December 15, 2021 -

So I've been trying to tackle this for a while and am a little stuck.

  1. The flow reads output from Excel into an Array (using Filter Array)

  2. I use String() to convert the Array to a single, very long string (Still in the jsonFormat)

So from

[{
"@odata.etag": "",
"Item": "12345",
"figures": "12",
"sourcename[Customername]": "Timmy"
},
{
"@odata.etag": "",
"Item": "567",
"figures": "9",
"sourcename[Customername]": "James"
}
]

This then becomes flat and is 1 very long string. (I can't use SELECT as Key names randomly have a prefix to them.

{"@odata.etag": "","Item": "12345","figures": "12","sourcename[Customername]": "Timmy"},{"@odata.etag": "","Item": "567","figures": "9","sourcename[Customername]": "James"}

3. I then use Compose > and the the replace() function to Analyse the long string and remove "Sourcename[" and ]

So far so good!

1 very long Json String and it's now in the right format (Customername)

--

This is where I run into trouble.

When I use Json() function to convert it back , I only get the very first Object (Where the customer name is Timmy.

anytime I use

json(outputs('compose_3')) 'Compose_3 being the very long Json string (string format).

I get this issue.

If I try splitting the string, I end up which a whole heap of "/" in the String (Which is what you expect when you convert a string to Array, you get a badly formatted Array.

"{\"@odata.etag\"\: \"\",\ etc These are escape characters in the backend (That compose normally filters out visually), but using the Split, it brings them to the front of view.

So I'm stuck on the correct way to handle this very long string and getting it to appear as multiple entries in ParseJson etc. I tried adding a manual "Apply To Each" but kept hitting the same issue with JSON() only returns Timmy and not any other records.

Any thoughts on what I can try here? This is the last step to get this working correctly.

🌐
UiPath Community
forum.uipath.com › learning hub › academy feedback
How do I create a JSON string from an Array? - Academy Feedback - UiPath Community Forum
Hello, So I see plenty of examples on how to take an JSON string the bot got from another service and deserialize it into an array for it to process. But I’m trying to go in the other direction. My bot has gathered various bits of information into an array and I want to encode that into a single JSON string that it can then pass out to the next service to handle.
Published: July 30, 2018