JSON or JavaScript Object Notation is nothing but a text-based human-readable data storing and interchange. Douglas Crockford originally specified the this format.
The media for this is application/json and the extension is .json.
This is an easier-to-use alternative of XML.
The below example shown an student object with an array of 3 records:
{"students":[
{"Name":"Tim", "Age":"25"},
{"Name":"John", "Age":"30"},
{"Name":"Jane", "Age":"45"}
]} Below example you can loop through:
<!DOCTYPE html>
<html>
<body>
<h2>Example</h2>
<p id="demo"></p>
<script>
var str = '';
var text = {"students":[{"Name":"Tim", "Age":"25"},{"Name":"John", "Age":"30"},{"Name":"Jane", "Age":"45"}]};
var obj = text.students;
for ( var i in obj) {
str +=obj[i].Name+ ":" + obj[i].Age+"<br>";
}
document.getElementById("demo").innerHTML = str;
</script>
</body>
</html> For AJAX JSON, is faster and easier.
JSON is quicker for reading and writing.
Content marketing has a hidden tax. It's not the writing itself, it's everything that happens…
Most marketing teams aren't failing because they lack data. They're failing because they can't act…
Email marketing continues to be one of the most effective ways for businesses to communicate,…
Xerox first introduced it around the mid-1970s. The need came up because the management activities…
Investing in the forex market may look to be a dangerous game. With some worthwhile…
The coronavirus outbreak has drastically changed the way we live our lives. Yes, that's absolutely…