This document introduces JSON (JavaScript Object Notation) as a lightweight data format that is easy for humans to read and write and for machines to parse and generate. It provides the syntax rules for JSON, which are derived from JavaScript object notation syntax. It compares JSON to XML, noting that while they are both hierarchical and self-describing, JSON is shorter, easier to read and write, allows use of arrays, and does not require end tags. Examples of JSON objects, arrays, strings, numbers, booleans, null values, and whitespace are also given.
Download as PPTX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
50 views
Lesson 1 - Intro To Json
This document introduces JSON (JavaScript Object Notation) as a lightweight data format that is easy for humans to read and write and for machines to parse and generate. It provides the syntax rules for JSON, which are derived from JavaScript object notation syntax. It compares JSON to XML, noting that while they are both hierarchical and self-describing, JSON is shorter, easier to read and write, allows use of arrays, and does not require end tags. Examples of JSON objects, arrays, strings, numbers, booleans, null values, and whitespace are also given.
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 36
INTRODUCTION TO { JSON}
SIR GERRY S. GOHIL, JR.
IT INSTRUCTOR WHAT IS JSON? • JSON (JavaScript Object Notation) is a lightweight data-interchange format . It is easy for humans to read and write. • It is easy for machines to parse and generate. • JSON is a text format that is completely language independent. • The format was specified by Douglas Crockford. JSON SYNTAX RULES
JSON syntax is derived from JavaScript object notation syntax:
• Data is in name/value pairs ex. Id: 1234
• Data is separated by commas ex. Id:1, name =“John” • Curly braces hold objects ex. { Id: “2”} • Square brackets hold arrays ex. Guitars:[brand:”Yamaha”] JSON VS XML
JSON is Like XML Because JSON is Unlike XML Because
• Both JSON and XML are "self describing" • JSON doesn't use end tag (human readable) • JSON is shorter • Both JSON and XML are hierarchical • JSON is quicker to read and write (values within values) • JSON can use arrays • Both JSON and XML can be parsed and used by lots of programming languages • Both JSON and XML can be fetched with an XMLHttpRequest JSON VS XML JSON EXAMPLE JSON VALUES
In JSON, values must be one of the following data types:
an object (JSON object)
a string a number an array a boolean null JSON Forms: An Object An object is an unordered set of name/value pairs. An object begins with { (left brace) and ends with } (right brace) Each name is followed by : (colon) and the name/value pairs are separated by, (comma) JSON Forms: An Array An array is an ordered collection of values. An array begins with [ (left bracket) and ends with ] (right bracket) Values are separated by, (comma) JSON Forms: A value A value can be a string in double quotes , or a number, or true or false or null, or an object or an array. These structures can be nested. JSON Forms: A String A string is a sequence of zero or more Unicode characters, wrapped in double quotes, using backslash escapes. A character is represented as a single character string. A string is very much lick a C or Java string. JSON Forms: A Number A number is very much like a C or Java number, except that the octal and hexadecimal formats are not used. JSON Forms: A Boolean It includes true or false values. JSON Forms: A whitespace and null Whitespace can be inserted between any pair of tokens. It can be added to make a code more readable. Example shows declaration with and without whitespace − A null means empty LESSON 1 - ACTIVITY: (STUDY THE GIVEN PPT SLIDES BEFORE ANSWERING THIS) Go to this link:
https://bit.ly/2QgLyrE
DEADLINE OF SUBMISSION: APRIL 23, 2021
THANK YOU! FOR QUESTIONS, YOU MAY CALL THIS NO. 0955 715 3573