In Java, convert a text string array to an array

I’m having trouble with my JSON response since I don’t know how to transform this string:

[“Lorem ipsum1”,“Lorem ipsum2”,“Lorem ipsum3”]

in java to array JSONObject.getString(“message”); produced this text. I considered using split() but was unable to set the necessary characteristics.
Thank you for your assistance! I use JSONObject.getJSONArray(“message”); and convert it to an array with this:

public static String[] getStringArray(JSONArray jsonArray){
          String[] stringArray = null;
          int length = jsonArray.length();
              stringArray = new String[length];
              for(int i=0;i<length;i++){
                  stringArray[i]= jsonArray.optString(i);
          return stringArray;
let arr = JSON.parse('["Lorem ipsum1","Lorem ipsum2","Lorem ipsum3"]');
1 Like

Thanks for helping! It works :slight_smile:

1 Like