developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/JSON
6 Users
0 Comments
87 Highlights
0 Notes
Top Highlights
it contains only properties
parse(): Accepts a JSON string as a parameter, and returns the corresponding JavaScript object.
JSON exists as a string — useful when you want to transmit data across a network. It needs to be converted to a native JavaScript object when you want to access the data.
JSON text basically looks like a JavaScript object inside a string
requires double quotes to be used around strings and property names
we converted the network response directly into a JavaScript object using response.json()
stringify(): Accepts an object as a parameter, and returns the equivalent JSON string.
It needs to be converted to a native JavaScript object when you want to access the data
JSON is a string whose format very much resembles JavaScript object literal format
can actually take the form of any data type
following JavaScript object syntax
Arrays as JSON Above we mentioned that JSON text basically looks like a JavaScript object inside a string. We can also convert arrays to/from JSON. Below is also valid JSON, for example:
Working with JSON
Converting a string to a native object is called deserialization
converting a native object to a string so it can be transmitted across the network is called serialization
JavaScript Object Notation (JSON) is a standard text-based format for representing structured data based on JavaScript object syntax.
It is commonly used for transmitting data in web applications (e.g., sending some data from the server to the client, so it can be displayed on a web page, or vice versa).
Even though it closely resembles JavaScript object literal syntax, it can be used independently from JavaScript, and many programming environments feature the ability to read (parse) and generate JSON.
JSON exists as a string — useful when you want to transmit data across a network. It needs to be converted to a native JavaScript object when you want to access the data.
This is not a big issue — JavaScript provides a global JSON object that has methods available for converting between the two.
Glasp is a social web highlighter that people can highlight and organize quotes and thoughts from the web, and access other like-minded people’s learning.