JSON
What is this?
{
"categories": [],
"created_at": "2020-01-05 13:42:25.352697",
"icon_url": "https://api.chucknorris.io/img/avatar/chuck-norris.png",
"id": "K4_b-yTOQ6GAPsaPF788kQ",
"updated_at": "2020-01-05 13:42:25.352697",
"url": "https://api.chucknorris.io/jokes/K4_b-yTOQ6GAPsaPF788kQ",
"value": "Earthquakes are borne from tectonic plates trembling from severe trepidation of Chuck Norris."
}
This is JSON - a format for data exchange on the web.
- Java
- Script
- Object
- Notation
JSON is a format for exchanging data that is consistent and predictable. It is based on key value pairs. Every key must be in double quotes.
To turn the json data returned from an api into a valid JavaScript/Typescript object use:
JSON.parse(“my JSON string”);
To convert a JavaScript object to a JSON string for sending as an HTTP request:
JSON.stringify