Working with JSON (Javascript Object Notation) Objects

JSON is a data interchange format for storing objects. JSON is language-independent, but is derived from JavaScript. Using JavaScript, we can do the following: For more information see https://www.w3schools.com/js/js_json_intro.asp

Example 1 (View source code to see how JSON.stringify is used)

JS code for creating mycourse object:

var mycourse = { course: "CSC 301", time: "MWF, 11:00 - 11:50" };

Example 2 (View source code to see how JSON.stringify is used)

JS code for creating prof object:

var prof = { firstName: 'Garrett', lastName: 'Dancik', 
             classes: ['CSC 202', 'CSC 301', 'CSC 314']};

Example 3

Wikipedia has an API that returns page titles and the first paragraph of an entry in JSON format, e.g., Eastern Connecticut State University

Example 4