question: public static ArrayList < Category > ParseCategories ( JSONObject jsonTotalObject ) { ArrayList < Category > categoryArrayList = new ArrayList < > ( ) ; try { JSONArray categories = jsonTotalObject . getJSONArray ( "categories" ) ; Category recent = new Category ( ) ; recent . setName ( "Recent" ) ; recent . setId ( 0 ) ; categoryArrayList . add ( recent ) ; for ( int i = 0 ; i < categories . length ( ) ; i ++ ) { JSONObject jsonObject = categories . getJSONObject ( i ) ; Category category = new Category ( ) ; category . setName ( jsonObject . getString ( "title" ) ) ; category . setId ( jsonObject . getInt ( "id" ) ) ; category . setSlugName ( jsonObject . getString ( "slug" ) ) ; categoryArrayList . add ( category ) ; } return categoryArrayList ; } catch ( JSONException e ) { Log . e ( TAG , "JSONException when loading categories" , e ) ; e . printStackTrace ( ) ; return null ; } }
target:  Parse JSON data in the webSide and return a List of category