Download presentation
Presentation is loading. Please wait.
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.