Best Android Studio Tutorial: How to Parse JSON from URL ☎️ ANDROID PHONE

The Easiest Android JSON Parsing Tutorial: How to Parse JSON from URL (Android Studio) works on any Android Phone. Please subscribe

Android Json Parsing Tutorial: How to Parse JSON from URL (Android Studio): In this video, I will teach how to do JSON Arrray Parsing in Android from URL of a website. Did you know there was no easy way to parse JSON from a URL into objects in Android? Originally we used JSONArray class to parse. Later Google released another lib called GSON. It was fairly useful and easy but you still needed to do a lot of code yourself, which consumed a lot of your time. Even worse, you needed to do the same thing over and over again from one project to another.

Please note that this tutorial may work on your older Samsung Galaxy, LG, Oppo, Huawei, Sony or Nokia Android phones which run Android Operating Systems depended on their API version.

Lately, I discovered a way to make it simpler. Instead of rewriting the code all the time, I created a reusable library. I uploaded the lib on GitHub at However, I still need GSON to be part of my lib. So you have to download the GSON as well, at or you add a Gradle — compile ‘’ — in your project.

To use that, first you add a model class that has its properties matching to JSON objects. For example, you have a tbl_post table and 4 attributes (post_id, post_title, post_text, image_url). Then by using json_encode() method in PHP, you should get the same object names in JSON. So, in Android you should create class named Post with 4 properties as well. See the sample code below:


public class Post {
@SerializedName(“post_id “)
public int post_id;
public String post_title;
public String post_text;
public String image_url;

The SerializeName annotation is the keyword that helps your JSON objects properties match an Android objects properties. You have to make sure they are the same.

After that, you need to add another library of mine at at read the JSON from URL to Android. You can check another YouTube at to see how to connect Android with PHP, MySQL in details.

Finally, what you have to do is to call a one magic line of code:


This code will parse the JSON text into objects. You can use that ArrayList for your custom ArrayAdapter to display texts and images in a ListView. But in this video, I make it simpler by just using a text list instead. Stay tuned for another awesome video about the custom ArrayAdapter.

Now, you are reaching the end of the Android JSON Parser from URL tutorial. Thanks for watching my video. Don’t forget to subscribe for more videos. Like and share it to your friends.

If you want cool videos like this, you can follow me:

Oum Saokosal

Photo Credit:
The photo ( used in my video cover is copyright (c) by Sergey Galyonkin ( made it available under Creative Commons (

The Creator of Channel Oum Saokosal
Android Json Parsing Tutorial