title: org.json.JSONException: No value for
body: <p>I get this error in logcat while fetch json data</p>
  
  <p>org.json.JSONException: No value for alberrnews</p>
  
  <p>also I'm using Retrofit 2 and I don't know if I posted baseurl in right way or not</p>
  
  <p>JsonArray</p>
  
  <pre><code>{"alberrnews":[{"title":"This is a title","subject":"This is a subject","image":"http:\/\/www.vcvcvc.com\/uploaded44\/33707\/61457017225.jpg"}]}
  </code></pre>
  
  <p>Main class</p>
  
  <pre><code>public class alberrClassNews extends Fragment {
  
  private RecyclerView recyclerView;
  private List&lt;alberrNewsListContent&gt; alberrNews = new ArrayList&lt;alberrNewsListContent&gt;();
  private final String TAG = "Get JSONArray";
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      View view = inflater.inflate(R.layout.alberrnewsclass, container, false);
      getActivity().setTitle("Main Class");
  
      recyclerView = (RecyclerView) view.findViewById(R.id.alberrNewsList);
  
      LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
      recyclerView.setLayoutManager(layoutManager);
      layoutManager.setReverseLayout(true);
      layoutManager.setStackFromEnd(true);
  
      final alberrNewsAdapter aNA = new alberrNewsAdapter(getActivity(), alberrNews);
      recyclerView.setAdapter(aNA);
  
  
      final ProgressDialog progressDialog = new ProgressDialog(getActivity());
      progressDialog.setMessage("loading");
      progressDialog.show();
  
      final Retrofit alberrRetrofit = new Retrofit.Builder()
              .baseUrl("http://mm.com/alrass_charties/")
              .addConverterFactory(GsonConverterFactory.create()).build();
      alberrService service = alberrRetrofit.create(alberrService.class);
  
  
      Call&lt;JSONObject&gt; call = service.alberrNews();
      call.enqueue(new Callback&lt;JSONObject&gt;() {
          @Override
          public void onResponse(Call&lt;JSONObject&gt; call, Response&lt;JSONObject&gt; response) {
              progressDialog.dismiss();
              Log.i(TAG, "success");
  
              try {
                  JSONArray jsonArray = response.body().getJSONArray("alberrnews");
                  for (int i = 0; i &lt; jsonArray.length(); i++) {
                      JSONObject jsonObject = jsonArray.getJSONObject(i);
                      alberrNewsListContent newsContent = new alberrNewsListContent();
  
                      newsContent.setAlberrNewsTitle(jsonObject.getString("title"));
                      newsContent.setAlberrNewsSubject(jsonObject.getString("subject"));
                      newsContent.setAlberrNewsImage(jsonObject.getString("image"));
                      alberrNews.add(newsContent);
                  }
  
  
                  aNA.notifyDataSetChanged();
              } catch (JSONException e) {
                  e.printStackTrace();
              }
          }
  
          @Override
          public void onFailure(Call&lt;JSONObject&gt; call, Throwable t) {
              Log.i(TAG, "Failed");
              progressDialog.dismiss();
  
              Toast.makeText(getActivity().getApplicationContext(), "no connection", Toast.LENGTH_SHORT).show();
  
          }
      });
      return view;
  
  }
  }
  </code></pre>
  
  <p>service class</p>
  
  <pre><code>public interface alberrService {
  @GET("alberr_news.php")
  Call &lt;JSONObject&gt; alberrNews();
  }
  </code></pre>
  
  <p>error in logcat</p>
  
  <pre><code>    03-09 04:08:43.617 18686-18696/? I/art: Debugger is no longer active
  03-09 04:08:43.656 18686-18686/? I/AppCompatViewInflater: app:theme is now deprecated. Please move to using android:theme instead.
  03-09 04:08:43.681 18686-18705/? D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
  03-09 04:08:43.712 18686-18686/? D/Atlas: Validating map...
  03-09 04:08:43.765 18686-18705/? D/libEGL: loaded /system/lib/egl/libEGL_emulation.so
  03-09 04:08:43.766 18686-18705/? D/libEGL: loaded /system/lib/egl/libGLESv1_CM_emulation.so
  03-09 04:08:43.771 18686-18705/? D/libEGL: loaded /system/lib/egl/libGLESv2_emulation.so
  03-09 04:08:43.812 18686-18705/? I/OpenGLRenderer: Initialized EGL, version 1.4
  03-09 04:08:43.857 18686-18705/? D/OpenGLRenderer: Enabling debug mode 0
  03-09 04:08:43.890 18686-18705/? W/EGL_emulation: eglSurfaceAttrib not implemented
  03-09 04:08:43.890 18686-18705/? W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xf3d0fea0, error=EGL_SUCCESS
  03-09 04:08:48.667 18686-18705/com.example.abdulmajeed.alrasscharities W/EGL_emulation: eglSurfaceAttrib not implemented
  03-09 04:08:48.667 18686-18705/com.example.abdulmajeed.alrasscharities W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xf3d0eae0, error=EGL_SUCCESS
  03-09 04:08:49.164 18686-18686/com.example.abdulmajeed.alrasscharities I/Get JSONArray: success
  03-09 04:08:49.165 18686-18686/com.example.abdulmajeed.alrasscharities W/System.err: org.json.JSONException: No value for alberrnews
  03-09 04:08:49.165 18686-18686/com.example.abdulmajeed.alrasscharities W/System.err:     at org.json.JSONObject.get(JSONObject.java:389)
  03-09 04:08:49.165 18686-18686/com.example.abdulmajeed.alrasscharities W/System.err:     at org.json.JSONObject.getJSONArray(JSONObject.java:584)
  03-09 04:08:49.165 18686-18686/com.example.abdulmajeed.alrasscharities W/System.err:     at com.example.abdulmajeed.alrasscharities.alberrClassNews$1.onResponse(alberrClassNews.java:74)
  03-09 04:08:49.165 18686-18686/com.example.abdulmajeed.alrasscharities W/System.err:     at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:66)
  03-09 04:08:49.165 18686-18686/com.example.abdulmajeed.alrasscharities W/System.err:     at android.os.Handler.handleCallback(Handler.java:739)
  03-09 04:08:49.165 18686-18686/com.example.abdulmajeed.alrasscharities W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
  03-09 04:08:49.165 18686-18686/com.example.abdulmajeed.alrasscharities W/System.err:     at android.os.Looper.loop(Looper.java:135)
  03-09 04:08:49.165 18686-18686/com.example.abdulmajeed.alrasscharities W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5254)
  03-09 04:08:49.165 18686-18686/com.example.abdulmajeed.alrasscharities W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
  03-09 04:08:49.165 18686-18686/com.example.abdulmajeed.alrasscharities W/System.err:     at java.lang.reflect.Method.invoke(Method.java:372)
  03-09 04:08:49.165 18686-18686/com.example.abdulmajeed.alrasscharities W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
  03-09 04:08:49.165 18686-18686/com.example.abdulmajeed.alrasscharities W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
  </code></pre>
  
  <p>=================================================================================</p>