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.
When people hear “AI” and “IoT,” they often think of smart assistants and connected gadgets.…
Look, I've been around the block when it comes to crystals and gemstones. Had my…
Why Maintenance Feels Overwhelming Most homeowners know they should maintain their roof, but many avoid…
Being involved in a car accident, whether it’s a minor or major collision can be…
Have you or your loved one been involved in a truck accident? Dealing with a…
Divorce is a serious decision that many families, unfortunately, face on a daily basis. It…