JSON- JavaScript Object Notation
format to store and transfer data
is Like a Object
JSON is a text
Most redable format
JSON is "self-describing" and easy to understand
***********************************************************************************
*********
Why Use JSON?
The JSON format is syntactically similar to the code for creating JavaScript
objects.
Because of this, a JavaScript program can easily convert JSON data into JavaScript
objects.
Since the format is text only, JSON data can easily be sent between computers, and
used by any programming language.
***********************************************************************************
*********
2 Methods-
*****
JSON.stringify();
********
convert JS object to JSON string- JSON.stringify()
Converts a JavaScript value to a JavaScript Object Notation (JSON) string.
JSON.stringify()
********************************************
JSON.parse()
Used to Convert JSON string data to plain JS Object
Converts a JavaScript Object Notation (JSON) string into an object.
*****************************************************************************
https://jsonplaceholder.typicode.com/
*********************************************************
How does API Works
What is Web API?
API stands for Application Programming Interface.
A Web API is an application programming interface for the Web.
A Browser API can extend the functionality of a web browser.
A Server API can extend the functionality of a web server.
https://www.peerbits.com/blog/complete-guide-to-api-development.html
https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.mailmodo.com%2Fguides%2Fapi
%2F&psig=AOvVaw0G9y6NOc4RcThjUDU9rMgx&ust=1698747912337000&source=images&cd=vfe&opi
=89978449&ved=0CBIQjRxqFwoTCKjopqDHnYIDFQAAAAAdAAAAABAE
************************************************
What is HTTP?
The Hypertext Transfer Protocol (HTTP) is designed to enable communications between
clients and servers.
HTTP works as a request-response protocol between a client and server.
Example: A client (browser) sends an HTTP request to the server; then the server
returns a response to the client.
The response contains status information about the request and may also contain
the requested content.
HTTP Methods
GET
POST
PUT
HEAD
DELETE
PATCH
OPTIONS
CONNECT
TRACE
*********************************************************
PUT VS PATCH method-
PUT - Update entire resources and modifying entire data
Patch- Update Partial Resource without modifying entire data
PATCH is used to apply partial updates to a resource, meaning that
only the fields that need to be changed are sent in the request body.
PUT is used to replace the entire resource with a new representation,
meaning that all the fields of the resource are sent in the request body, even if
they are not modified.
***********************************************************************
What is Postman used for?
Postman: Postman is an API(application programming interface) development tool
which helps to build, test and modify APIs. A
***********************************************************************
1. Create Directory- JSON_App
create react app- npm init
npx create-react-app my-app
cd my-app
2. setup JSON Server
cd my-app
mkdir json_data
cd json_data- > npm i -g json-server@0
3. Creating JSON file and then Start JSON server
npx json-server --watch db.json
localhost:3000
https://reqres.in/api/users?page=2
https://jsonplaceholder.typicode.com/users