json.org 1.0 KB

JSON (Javascript Object Notation) What is it?

a number

a string

a boolean (true or false)

an array (in square brackets)

an object (in curly braces)

null

Basic example of syntax

Create an object with lots of members with curly brackets {}:

JSON is a subset of javascript that lets you declare an object’s members and values as well as all of its children’s members and values. The values that JSON can specify are: var person = { “firstName” : “John”, “lastName” : “Doe”, “height” : “6”, “single” : true, “pet” : null }

Create an object with members and a child array with brackets [];

person.firstName --> “John” person.pet --> null var teacher = { “name” : “Mr. Boss”, “classSize” : “20”, “students” : [ “student1” : “Greg”, “student2” : “Jane” ] }

teacher.name --> “Mr. Boss” teacher.students[0].student1 --> “Greg”