As beginner in programming, do you have ever heard about JSON?

At first, I don’t know what is JSON. Maybe it’s just an object that used to receive data from server or something like that. Well, I was wrong.

So, what is JSON? Based on what I searched, I found this. All credits to squarespace. Enjoy! …

JSON (JavaScript Object Notation) is a minimal, readable format for structuring data. It is used primarily to transmit data between a server and web application, as an alternative to XML. Squarespace uses JSON to store and organize site content created with the CMS.


Append ?format=json-pretty to the URL of any page on your Squarespace site and you’ll be able to view the JSON data for the site..

Keys and Values

The two primary parts that make up JSON are keys and values. Together they make a key/value pair.

  • Key: A key is always a string enclosed in quotation marks.
  • Value: A value can be a string, number, boolean expression, array, or object.
  • Key/Value Pair: A key value pair follows a specific syntax, with the key followed by a colon followed by the value. Key/value pairs are comma separated.

Let’s take one line from the JSON sample above and identify each part of the code.

"foo" : "bar"

This example is a key/value pair. The key is “foo” and the value is “bar”.

Types of Values

  • Array: An associative array of values.
  • Boolean: True or false.
  • Number: An integer.
  • Object: An associative array of key/value pairs.
  • String: Several plain text characters which usually form a word.

Numbers, booleans and strings are self-evident, so we’ll skip over those sections. Arrays and Objects are explained in more depth below.


Almost every blog has categories and tags. In this example we’ve added a categories key, but the value might look unfamiliar. Since each post in a blog can have more than one category, an array of multiple strings is returned.

"foo" : {
  "bar" : "Hello",
  "baz" : [ "quuz", "norf" ]


An object is indicated by curly brackets. Everything inside of the curly brackets is part of the object. We already learned a value can be an object. So that means “foo” and the corresponding object are a key/value pair.

"foo" : {
  "bar" : "Hello"

The key/value pair “bar” : “Hello” is nested inside the key/value pair “foo” : { … }. That’s an example of a hierarchy in JSON data.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s