wattry
wattry

Reputation: 994

Deserializtion a JSON array string into a string array

I am working with JSON strings for the first time and I have a Monday deadline so I don't have time to get into the nitty gritty of JSON.

I get this returned from the API:

["10","11","12","13","14","15","112","113"]

I need to convert it to some thing like:

string[0] = 10;
string[1]=  11; 

etc... Can I convert that string into array?

I keep getting a deserializtion error because it cannot convert it from an array

Upvotes: 0

Views: 46

Answers (1)

user2845466
user2845466

Reputation: 36

JSONArray arr = new JSONArray(yourJSONresponse);

List list = new ArrayList();

for(i = 0; i < arr.length; i++){

list.add(arr.getJSONObject("name")); }

Upvotes: 1

Related Questions