Skip to content Skip to sidebar Skip to footer

Fetching Integer List From Json

{ 'ID': 1, 'Name': 'Aman', 'Description': 'Food', 'FeedbackTypeID': 2, 'BanckMark': 50, 'CutoffPercentage': 50, 'IsOverridable': false, 'ApplicableBranchId': [

Solution 1:

You can extract the ApplicationBranchId array out of the JSON object by using .getJSONArray() to return a JSONArray object. From here you can parse it how you like

JSONArray jsonArr = mainJSON.getJSONArray("ApplicableBranchId"); 

Solution 2:

I create demo for get your JSONArray data.

You have to do like below to get data from JSONArray.

JSONArrayjsonArray= jsonObject.getJSONArray("ApplicableBranchId");
for(int i=0;i<jsonArray.length();i++){
        intdata= jsonArray.getInt(i);
}

Solution 3:

Use this code to get ApplicationBranchId from json

    JsonObject object = new JsonObject("response");
    JsonArray array = object.getJSONArray("ApplicableBranchId"); 
    for(int i ; array<lenght(); i++){
    Log.e("", "Branch Id -: " + array.getInt(i););}

Here BranchId is print in logcat.

Happy To Help and Happy Coding.

Post a Comment for "Fetching Integer List From Json"