/
 JSON JavaScript Object Notation  JSON JavaScript Object Notation

JSON JavaScript Object Notation - PowerPoint Presentation

danika-pritchard
danika-pritchard . @danika-pritchard
Follow
364 views
Uploaded On 2020-04-06

JSON JavaScript Object Notation - PPT Presentation

JavaScript Object Notation Plain text file format Although originally derived from the JavaScript scripting language JSON is a languageindependent data format Whitespace outside of strings isnt meaningful ID: 776188

json type file schema json type file schema description price green product tags object string required true strings door

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document " JSON JavaScript Object Notation" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

JSON

JavaScript Object Notation

Slide2

JavaScript Object Notation

Plain text file format

Although originally derived from the JavaScript scripting language, JSON is a language-independent data format.

Whitespace (outside of strings) isn't meaningful.

One data type allowed per file (but often it is a container)

Slide3

JSON string

string: a sequence of zero or more Unicode characters. Strings are delimited with double-quotation marks and support a backslash escaping syntax.

"Hi\nEveryone"

Slide4

JSON Strings

Which of these are JSON strings?Josh"Josh\n""\_(^^)_/"""

Slide5

JSON number

number: a signed decimal number that may contain a fractional part and may use exponential E notation.

4

12.5

6.022e23

-5.6

Slide6

JSON array

array: an ordered list of zero or more values, each of which may be of any type.

[][4, "Josh", true][[], null]

Slide7

JSON object

object: an unordered collection of name/value pairs where the names (also called keys) are strings.

{"name":"Josh", "age":17, "section":[1,2]}

Slide8

JSON values (null and boolean)

null: empty value

nullboolean: either of the values truefalse

Slide9

Example JSON File

{

"name":"josh",

"pets": [{

"name": "zoe",

"age":7,

"birthday":null,

"species":"dog",

"commands":["fetch", "shake", "come"]

}],

"employed":true

}

Slide10

JSON Schema

A schema is a definition of how the data should be formatted.Schema can be used for validation. JSON schema is currently in a working draft, but is already very broadly used.Info available at: http://json-schema.org/

Slide11

JSON Schema

Example JSON File{ "id": 1, "name": "A green door", "price": 12.50, "tags": ["home", "green"]}

Questions the schema should answer:

What is the data?

What is

id

?

Is

name

required?

Can

price

be 0?

Are all

tags

strings?

Slide12

Example JSON File{ "id": 1, "name": "A green door", "price": 12.50, "tags": ["home", "green"]}

JSON Schema File{ "title": "Product", "description": "Product from catalog", "type": "object"}

What is the data?

Slide13

Example JSON File{ "id": 1, "name": "A green door", "price": 12.50, "tags": ["home", "green"]}

JSON Schema File{ "title": "Product", "description": "Product from catalog", "type": "object", "properties": { "id": { "description": "unique id", "type": "integer" } }, "required": ["id"]}

What is

id

?

Slide14

Example JSON File{ "id": 1, "name": "A green door", "price": 12.50, "tags": ["home", "green"]}

JSON Schema File{ "title": "Product", "description": "Product from catalog", "type": "object", "properties": { "id": { "description": "unique id", "type": "integer" }, "name": { "description": "Name item", "type": "string" } }, "required": ["id", "name"]}

Is

name

required?

Slide15

Example JSON File{ "id": 1, "name": "A green door", "price": 12.50, "tags": ["home", "green"]}

JSON Schema File{ "title": "Product", "description": "Product from catalog", "type": "object", "properties": { "id": { "description": "unique id", "type": "integer" }, "name": { "description": "Name item", "type": "string" }, "price": { "type": "number", "minimum": 0, "exclusiveMinimum": true } }, "required": ["id", "name", "price"]}

Can

price

be 0?

Slide16

Example JSON File{ "id": 1, "name": "A green door", "price": 12.50, "tags": ["home", "green"]}

JSON Schema File{ "title": "Product", "description": "Product from catalog", "type": "object", "properties": { "id": { "description": "unique id", "type": "integer" }, "name": { "description": "Name item", "type": "string" }, "price": { "type": "number", "minimum": 0, "exclusiveMinimum": true }, "tags": { "type": "array", "items": { "type": "string" }, "minItems": 1, "uniqueItems": true } }, "required": ["id", "name", "price"]}

Are all

tags

strings?

Slide17

JSON Schema

Are JSON Schema required for interpretation of JSON data? YesNo

JSON Schema File

{ "title": "Product",

"description": "Product from catalog",

"type": "object",

"properties": {

"id": {

"description": "unique id",

"type": "integer" },

"name": {

"description": "Name item",

"type": "string" },

"price": {

"type": "number",

"minimum": 0,

"exclusiveMinimum": true },

"tags": {

"type": "array",

"items": {

"type": "string" },

"minItems": 1,

"uniqueItems": true } },

"required": ["id", "name", "price"]

}