How to get json data from url in android studio

This article about get JSON data from URL in an android example, In this article, we will going to learn how to get JSON data from URL.

In this project we will first create php script for convert data to json format.

What you can learn in this Android Tutorial?

  • In this tutorial, You can learn how to create a PHP script for JSON data.
  • Using JSON data in the android application.
  • Convert MySQL data to JSON.
  • how to we retrieve data from the database using JSON?.
  • how to fetch data from the database using JSON in PHP?.
  • get JSON from URL android studio.

Write php script for Json data

  • In this PHP script, we will create a method convert MySQL data into JSON format.
  • you can see below the PHP code.


$sql=”SELECT * FROM `infodata`”;




echo json_encode($data);


Now You can see bellow result after runing this php script.

“name”:”Hiren Pithwa”,
“founder”:”Unique Andro Code”,

“name”:”Ravi Kiyada”,
“name”:”Nikhil Jivrajani”,
“founder”:”Jnj Store”,

If you want this json data display in android app you can read This article



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store