JSON & JavaScript objects are really easy to generate,…so let's take a look at some examples of how you would express different types of information in this format.…The most common type of data you would express is key and value pairs.…They are list of keys with their associated values.…Multiple values are separated with commas.…So if we want to add something here--I'll just type Return, I'll put a couple of spaces…and I'll add another key and then I'll place a value on that key and I would need a comma at the end.…
Now notice that the last element doesn't need a comma.…You can use whitespace for clarity if you want to, so you can add any number of tabs,…spaces, or a carriage returns and it won't affect the object in any way.…You don't need quotes on numbers, the values true and false--which are the Booleans--or…the special value null.…Once the data has been parsed into a variable, it becomes a JavaScript object.…The easiest way to access elements in JavaScript is to use dot notation.…So you could use info.full_name to access the name of this person.…
Released
3/15/2013- What is JSON?
- Creating simple data
- Debugging JavaScript objects in the browser
- Communicating across sites with JSONP
- Rotating with jQuery Cycle
Share this video
Embed this video
Video: Creating simple data