How do I return the JSONObject data as a table


I am trying to return the data from a JSONObject as array so i can loop through them. followed android development training on udacity but the JSON structure used in the training is different from what i am using. below is my class

  private String[] getWeatherDataFromJson(String forecastJsonStr)
            throws JSONException {

        // These are the names of the JSON objects that need to be extracted.
        final String OWM_LIST = "rules";
        final String OWM_DESCRIPTION = "game_rules_content";

        JSONObject forecastJson = new JSONObject(forecastJsonStr);
        JSONArray weatherArray = forecastJson.getJSONArray(OWM_LIST);
        Log.v(LOG_TAG, "success: " + forecastJson.getInt("success"));

       //I guess my problem is starts here
       String[] resultStrs = new String[1];

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

            String rule;
            // Get the JSON object representing the day
            JSONObject dayForecast = weatherArray.getJSONObject(i);
            rule = dayForecast.getString(OWM_DESCRIPTION);
            Log.v(LOG_TAG, "sammy: " + rule);

             // how do i return my json data as array for i loop through the array with for
            resultStrs[0] = rule;


        for (String s : resultStrs) {
            Log.v(LOG_TAG, "Forecast entry: " + s);
        return resultStrs;


you can post link get json or your json. If can u should try gson library for parse json, ex here: gson example