JSON (JavaScript Object Notation) is a data-interchange format commonly used for exchanging data between a browser and a server.
-
Sending Data--If you have data stored in a JavaScript object, you can convert the object into JSON, and send it to a server(JSON.stringify())
-
Receiving Data--If you receive data in JSON format, you can convert it into a JavaScript object(JSON.parse())
Common use of JSON parser is to read data from a web server, and display the data in a web page.
The JSON format is almost identical to JavaScript objects. JSON syntax is derived from JavaScript object notation syntax:
- Data is in name/value pairs
- Data is separated by commas
- Curly braces hold objects
- Square brackets hold arrays
In JSON, values must be one of the following data types:
- a string
- a number
- an object (JSON object)
- an array
- a boolean
- null
- clone/download the repository
- install node
- run command "node jsonReader.js "
Jasmine is a behavior-driven development framework for testing JavaScript code. It does not depend on any other JavaScript frameworks. It does not require a DOM. And it has a clean, obvious syntax so that user can easily write tests.
To run unit tests, open index.html (inside jasmine folder) on the browser.