Presentation is loading. Please wait.

Presentation is loading. Please wait.

JSON Crash Course Traversy Media.

Similar presentations


Presentation on theme: "JSON Crash Course Traversy Media."— Presentation transcript:

1 JSON Crash Course Traversy Media

2 What is JSON? JavaScript Object Notation
Lightweight data-interchange format Based on a subset of JavaScript Easy to read and write Often used with AJAX Can be used with most modern languages

3 Data Types Number: No difference between integer and floats
String: String of Unicode characters. Use double quotes Boolean: True or false Array: Ordered list of 0 or more values Object: Unordered collection of key/value pairs Null: Empty value

4 JSON Syntax Rules Uses key/value pairs – {“name”:”Brad”}
Uses double quotes around KEY and VALUE Must use the specified data types File type is “.json” MIME type is “Application/json”

5 JSON Example { “name”:”Brad Traversy”, “age”: 35, “address”: { “street”:”5 main st”, “city”:”Boston” }, “children”: [“Brianna”, “Nicholas”] }

6 Accessing Values var person = { "name":“Brad", "age":31, “address":{“city”:“Boston“}}; alert(person.name); // Brad alert(person.address.city); // Boston alert(person["name"]); // Brad

7


Download ppt "JSON Crash Course Traversy Media."

Similar presentations


Ads by Google