How are API's and JSON related, come somebody help me understand the relationship ?
#AskNostr
How are API's and JSON related, come somebody help me understand the relationship ?
#AskNostr
JavaScript object notaion (JSON) is a widely used text format for sending data across the internet. Most APIs send and receive data in this format.
In addition, API stands for Application Programming Interface. APIs take many forms, but when an API uses a web transport to communicate (such as HTTP or WebSockets), JSON is likely to be the data encoding it uses.
The benefit of JSON is that it is natively parsable in any JavaScript environment, as well as in many non-JavaScript environments, and is also human readable. The downside of JSON encoding is that it is not as dense as a binary format would be, and is incapable of representing some data types without further encoding (such as base64).
#AskNostr FTW!
An api is the programming interface to an application
Generally a rest api would return data in json format but it doesn’t have to
The api would define more things like url, authentication, http method, query parameters in the url and what they mean or data to send to the api endpoint and probably more