java - Android convert JSONArray to String Array -
I get data from Jason and have a Jason array. I want to change that Jason array to string array, so I I can send it to another activity and show it in the Here is my Java code I try that code to replace Item_list want to change the array like this Can send any other activity in the intent and show it in what do you have You need to parse Now you can add a string to a list / array and after that it may be necessary. ListView .
if (jsonStr! = Null) {try {foodsFilter = new JSONArray (jsonStr); // Looping for all contacts (int i = 0; i & lt; foodsFilter.length (); i ++) {JSONObject c = foodsFilter.getJSONObject (i); If (c.getString ("category_name"). Equals ("food")) {string category_name = c.getString (TAG_CATEGORY_NAME); String filter_type = c.getString (TAG_FILTER_TYPE); // string item_list = c.getString (TAG_ITEM_LIST); JSONArray Item List = New JSONArray (c.getString ("item_list")); String item_list = itemList.toString (); // TMP Hashpe Hashmap for Single Contact
JSONarray , but I realized that the code
JSONArray is passed to
Is to convert to string .
JSON data
here [{"category_name": "food", "filter_type": "sort", "field_name" : "Code": "VALUE", "table_name": "", "item_list": ["ascending", "descending"]}]
item_list = {"ascending", "descending"}
ListView
string item_list = ite MList.toString ();
items_list which is
JSONArray .
JSONArray item list = New JSONArray (c.getString ("item_list")); // Get loop and list through array item (int i = 0; i & lt; itemList.length (); i ++) {string item = itemList.getString (i); // item on the index i}
Comments
Post a Comment