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.

1 comment:

  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

React UI, UI UX, Reactstrap React Bootstrap

React UI MATERIAL  Install yarn add @material-ui/icons Reactstrap FORMS. Controlled Forms. Uncontrolled Forms.  Columns, grid