Retrieving an array from within an a JSONArray in android : I've got the following JSON String:

    {
        "error":false,
        "message":"modules retrieved successfully",
        "subjectsEnrolled":
        {
            "studentNumber":"PT2014-1282",
            "courseId":1,
            "moduleNames":["Internet Programming and E-commerce","Operating Systems","Java and Distributed Systems"]
        }
    }

and I would like to retrieve the values in `moduleNames`.

Current method to try and retrieve the values is:

    @Override
        protected void onPostExecute(String s) {

            super.onPostExecute(s);

            try {

                JSONObject object = new JSONObject(s);
                JSONArray array = object.getJSONArray("moduleNames");
               
                if (!object.getBoolean("error")) {
                    Toast.makeText(getActivity(), object.getString("message"), Toast.LENGTH_SHORT).show();
                    
                } else {



                }
            } catch (JSONException e) {

                e.printStackTrace();
                Log.e("JSON Parser", "Error parsing data " + e.toString());

            }
        }

Followed with the following trace:

     10-29 20:48:50.741 14484-14484/com.example.vhuhwavho.mylms W/System.err: org.json.JSONException: No value for moduleNames
        10-29 20:48:50.741 14484-14484/com.example.vhuhwavho.mylms W/System.err:     at org.json.JSONObject.get(JSONObject.java:355)
        10-29 20:48:50.741 14484-14484/com.example.vhuhwavho.mylms W/System.err:     at org.json.JSONObject.getJSONArray(JSONObject.java:549)
        10-29 20:48:50.741 14484-14484/com.example.vhuhwavho.mylms W/System.err:     at com.example.vhuhwavho.mylms.ModulesFragment$PerformNetworkRequest.onPostExecute(ModulesFragment.java:166)
        10-29 20:48:50.741 14484-14484/com.example.vhuhwavho.mylms W/System.err:     at com.example.vhuhwavho.mylms.ModulesFragment$PerformNetworkRequest.onPostExecute(ModulesFragment.java:137)
        10-29 20:48:50.741 14484-14484/com.example.vhuhwavho.mylms W/System.err:     at android.os.AsyncTask.finish(AsyncTask.java:632)
        10-29 20:48:50.741 14484-14484/com.example.vhuhwavho.mylms W/System.err:     at android.os.AsyncTask.access$600(AsyncTask.java:177)
        10-29 20:48:50.741 14484-14484/com.example.vhuhwavho.mylms W/System.err:     at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)
        10-29 20:48:50.741 14484-14484/com.example.vhuhwavho.mylms W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:102)
        10-29 20:48:50.741 14484-14484/com.example.vhuhwavho.mylms W/System.err:     at android.os.Looper.loop(Looper.java:146)
        10-29 20:48:50.741 14484-14484/com.example.vhuhwavho.mylms W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5487)
        10-29 20:48:50.741 14484-14484/com.example.vhuhwavho.mylms W/System.err:     at java.lang.reflect.Method.invokeNative(Native Method)
        10-29 20:48:50.741 14484-14484/com.example.vhuhwavho.mylms W/System.err:     at java.lang.reflect.Method.invoke(Method.java:515)
        10-29 20:48:50.746 14484-14484/com.example.vhuhwavho.mylms W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
        10-29 20:48:50.746 14484-14484/com.example.vhuhwavho.mylms W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
        10-29 20:48:50.746 14484-14484/com.example.vhuhwavho.mylms W/System.err:     at dalvik.system.NativeStart.main(Native Method)
        10-29 20:48:50.746 14484-14484/com.example.vhuhwavho.mylms E/JSON Parser: Error parsing data org.json.JSONException: No value for moduleNames

Any advice?
