Quantcast
Channel: JavaScript – iAdvise blog
Viewing all articles
Browse latest Browse all 14

5 Minute JavaScript #10 JSON

$
0
0

This week we’re taking a break from complex code structures (like modules in the previous issue) and we get back to basics. JSON is a lightweight data-interchange format. Easy to read/parse but also to write/generate. It’s related to the way we notate objects in JavaScript, that’s why it’s called JavaScript Object Notation. Visit the website: http://json.org/ for complete information about JSON.

An example of a JSON object

{
    "str": "string",
    "bool": false,
    "obj": {
        "arr": [ 1, 2, 3, "string", false ]
    }
}

JSON is a popular way of formatting data when dealing with REST services. Whenever you are generating data (at REST level at the back-end) for web applications, you know that your data will be read and parsed by JavaScript. What better format for JavaScript to parse than its own object notation? This is why JSON is such a great way to interchange data. It’s lightweight, fast, easy, readable…

There are also some useful tools that you can use regarding JSON. http://jsonlint.com/ for example checks if your JSON-string is formatted correctly. http://json-schema.org/ describes your JSON-object in a way very similar to XML-schemas.



Viewing all articles
Browse latest Browse all 14

Latest Images

Trending Articles





Latest Images