how to create a Json array of strings in android

前端 未结 2 390
滥情空心
滥情空心 2021-01-23 04:59

I am trying to create an array like this [\"stringone\",\"stringtwo\"] and pass it to the webserver. When I tried doing making it with a string array like Str

2条回答
  •  一生所求
    2021-01-23 05:36

    If you want to create JSONArray from List or array, you can use constructor, which takes Collection:

    String[] data = {"stringone", "stringtwo"};
    JSONArray json = new JSONArray(Arrays.asList(data));
    

提交回复
热议问题