This article will discuss how to read a JSON file and display the details in table format using PHP. To use PHP function file_get_contents () we can read a file and retrieve the data present in JSON file. After retrieving data need to convert the JSON format into an array format. Then with the use of looping statement will display as a table format.
JSON input file - file.json
The below code will confirm if a JSON file is present or not. If a JSON file is not there it will display "JSON file Not found"
Once we get array details using foreach loop we will display output in the table
Output
![]()