JSON basics in 10 minutes

Modern software is all about manipulating data. It has to be stored, transferred, analyzed and produced. For all that you have to store your data in some simple, multifunctional and lightweight format. One of the most popular nowadays is JSON format.

json basics in 10 minutes

This is JSON basics in 10 minutes guide. If you are wondering what JSON abbreviation is it is for JavaScript Object Notation. Despite, JSON syntax originates from JavaScript, it does not mean it can be used only with this programming language. JSON is language independent format; JSON data can be read and generated by any programming language.

Moreover, JSON basically is text format so it can be easy understood both by people and computer.

JSON syntax has a few easy rules to remember:

  • Data is stored in key/value pairs
  • All data records are separated by commas
  • Objects are stored between curly brackets
  • Arrays are stored between square brackets

    {
    "classmates":[
        {"firstName":"Jack", "lastName":"Dors"}, 
        {"firstName":"Alice", "lastName":"Cook"},
        {"firstName":"Meghan", "lastName":"White"}
        ]
    }

    As you can see from the example above, objects are wrapped with curly braces:

    { "classmates” : […] }

    The square brackets are used to indicate an array.
    A key/value pair is composed of a field name in double quotes, followed by a colon and a value itself:

    "firstName":"Jack"

    In JSON objects can have multiple key/value pairs:

    {"firstName":"Jack", "lastName":"Dors"}

    To sum up, JSON is concise format for data transferring. Primary it is used for browser/server communication.

by Aliona Khomyk

Leave a Reply

Be the First to Comment!