Did you know that you can navigate the posts by swiping left and right?

Understand JSON - Part 1: Introducing JSON

January 25, 2016, March 09, 2016 | Comments

category: TECH
json javascript

In the next couple of blogs, I will cover some basics of JSON and how to parse it with different technical tools. And the goal of this series would help readers understand JSON better and use/parse it appropriately based on different scenarios.

alt text

JSON stands for JavaScript Object Notation, first introduced to the world at JSON.org in 2001. It is a text format that facilitates structured data interchange between all programming languages. It is open, lightweight, and text-based data-interchange format. According to The JSON Data Interchange Standard, JSON is syntax of braces, brackets, colons, and commas that is useful in many contexts, profiles, and applications.

JSON supports two widely-used data structures:

  • A collection of name/value pairs
  • An ordered list of values
  • JSON supports the following data types:

  • Null
  • True/False
  • Number
  • String
  • JSON uses the following structural tokens:

  • Curly Brackets { }
  • Square Brackets [ ]
  • Colon :
  • Comma ,
  • Combining data types with structural tokens, JSON could generate different kinds of values: object, array, string, number, True/False and Null. Object: a pair of curly bracket tokens surrounding zero or more name/value pairs. Name is a string and value could be any data types. A single colon is used to separate name from value and a single comma is used to separate different name/

    {"China": "86", "USA": "1"}
    "ID": "F1234567",
    "Company": "ABC Inc.",
    "Location": "Antarctica"

    Array: a pair of square bracket tokens surrounding zero or more values. The values are separated by commas. The order of the values is significant. Here are some examples:

    [1, 2, 3, 4, 5]
    [True, False, Null, True]

    String: a sequence of Unicode code points wrapped with quotation marks. Single quotation mark(“) or single backward slash() is not allowed in a string with other special characters(see page 10 of The JSON Data Interchange Standard). These special characters should be represented by a single backward slash + special character.


    (1). Introducing JSON, http://www.json.org/.