Ad

Saturday, November 16, 2013

Basic JSON Format | JSON for Dummies

The basic JSON building block is a data attribute and value pair. It's a way to track data records in JavaScript.
{"attribute" : "value"}
e.g. {"name":"dilys"}

Every two building blocks are separated with a comma.
{"first name":"John","last name":"Doe"}

We can format the JSON better by displaying it hierarchically
{
"first name":"John",
"last name":"Doe"
}

To check if your JSON is correct you can use JSONLint auto checking
http://jsonlint.com/

To see more complex examples of JSON and also compounded, nested JSON objects
http://json.org/example.html

JSON is more useful than ever because most APIs like Google Map can provide data in JSON format. Key-value data stores used in nosql is also similar: a key value pair. There are subtle and important differences. Since this is an intro blog, I won't go into details. Consider this a JSON cheat sheet. 

[Updated] JSONLint is especially helpful when we can easily confuse JSON notation with key-value stores, i.e. missing double quotes. Just caught a data analysis book messing up JSON format slight today.

3 comments:

  1. Ever wondered why not a lot of people succeed in forex trading even though based on literature it is an easy endeavor to succeed in? Find out what their missing ingredient is.http://www.thesisexample.info/

    ReplyDelete
  2. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog.
    Really very informative post you shared here. Kindly keep blogging.
    If anyone wants to become a Front end developer learn from Javascript Online Training from India .
    or learn thru JavaScript Online Training from India.
    Nowadays JavaScript has tons of job opportunities on various vertical industry. ES6 Training in Chennai

    ReplyDelete

Sample .gitignore file

Some good files to ignore .DS_Store a hidden file generated by Mac, .ipynb_checkpoints, hidden files generated by Python Notebooks aka Ju...