Fetching JSON Data from API’s and Viewing in WebPage using Core JavaScript without Any Library
In this article I would like to show you how you can get data from api’s and dispplay in HTML page. This is a basic a article to demonstrate you the power of JavaScript
No more discussion lets jump into the code
jsonplaceholder.com is a fake json provider. We will use their api’s to get data.
API’s Endpoint: https://jsonplaceholder.typicode.com/posts
Data Fromat: We can see this api’s proivde an array of object. Which have the following attribute: userId, id, title,body
[ {
“userId”: 1,
“id”: 1,
“title”: “sunt aut facere repellat provident occaecati excepturi optio reprehenderit”,
“body”: “quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto”
}]
Check the code.
If you have any doubt or suggeston feel free to comment. I would love to learn from you