Categories: Json

What is JSON?

Share

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>

So why JSON?

For AJAX JSON, is faster and easier.
JSON is quicker for reading and writing.

Published by
Namaste UI

Recent Posts

Overview of Reputation, Services, and Features of IplWin

IplWin stands as a reliable and enthralling platform for Indian punters, offering a captivating blend…

2 days ago

Blogging Brilliance: Driving Traffic and Engagement with Quality Content

Introduction In today's online age, consumers are constantly bombarded with information. They crave valuable content…

3 days ago

How Assisted Living Gives Seniors More Freedom

In today’s rapidly aging society, finding a living situation that provides older adults with both…

3 days ago

Should you go for a Refurbished Mac?

If you wish to purchase a Mac, then it is strongly suggested to consider purchasing…

3 days ago

How Many Types of Bits are Used in Drilling Operations?

Oil drilling is a complex process that involves several components, including the drilling bit. The…

4 days ago

Best Watches to Match Your Business Look

Watches can be more than a fashion. They can be a symbol, especially in the…

4 days ago