×
Clear all filters including search bar
Valeri Tandilashvili's Personal Professional Blog
Object
- a collection of key/value pairs
Array
- an ordered list of valuesvar obj = { name: "John", age: 30, city: "New York" };
// Converts object into JSON string
var myJSON = JSON.stringify(obj);
// Puts the string into element with id: demo
document.getElementById("demo").innerHTML = myJSON;
JSON.parse()
Parses the data and converts it into a JavaScript objectlet txt = '{"name":"John", "age":30, "city":"New York"}'
// Converts JSON string into a JavaScript object.
let obj = JSON.parse(txt);
// Puts the data into "p" element with id: demo
document.getElementById("demo").innerHTML = obj.name + ", " + obj.age;
- a function
- a date
- a symbol
- undefined
,
These are enclosed in square brackets []
which means that array begins with [
and ends with ]
{
"books": [
{ "language":"Java" , "edition":"second" },
{ "language":"C++" , "lastName":"fifth" },
{ "language":"C" , "lastName":"third" }
]
}
JSON
stands for JavaScript Object Notation
JSON
is a way of communicating data with specific rules
JSON
is a syntax for storing and exchanging data
JSON
is text, written with JavaScript object notation
The syntax is taken from JavaScript
but JSON
is portable with other languages
JSON
is a lightweight data-interchange format
It's easy for humans to read and write
It's easy for machines to parse and generate
A common use of JSON is to exchange data to/from
a web server
application/json
is the official Internet media type for JSON
.json
is the JSON
filename extension- More secure
- Faster
- Stores a larger amount of data
- Stored data is not sent with every server request
Note: Local storage is per domain. All pages from one domain can store and access the same data.
<progress>
element provides the ability to create progress bars on the web. The progress element can be used within headings, paragraphs, or anywhere else in the bodyStatus: <progress min="0" max="100" value="35">
</progress>
Note: Use the <progress> tag in conjunction with JavaScript to dynamically display a task's progress
<video controls autoplay loop>
<source src="http://www.sololearn.com/uploads/video.mp4" type="video/mp4">
<source src="http://www.sololearn.com/uploads/video.ogg" type="video/ogg">
Video is not supported by your browser
</video>
In this example, the video will replay after it finishes playing
Note: Currently, there are three supported video formats for the <video> element: MP4, WebM, and OGG