Basically Syntax of JSON is the subset of the JavaScript syntax.
It has following notation:
{"students":[ {"Name":"Tim", "Age":"25"}, {"Name":"John", "Age":"30"}, {"Name":"Jane", "Age":"45"} ]}
So,
students[0].Name + “:” + Name[0].Age;
will be Tim:25
The following datatypes are supported by JSON:
Number, String, Boolean, Array, Object, Whitespace, null
Read Also: Json JSON with Ajax
JSON reads data from a web server, and display in a web page.
var text = ‘{“students”:[
{“Name”:”Tim”, “Age”:”25″},
{“Name”:”John”, “Age”:”30″},
{“Name”:”Jane”, “Age”:”45″}
]}’;
Object From String:
JSON.parse(text) can be used to convert a JSON string into a JavaScript object:
var obj = JSON.parse(text);
Using eval():
You can use eval() function to convert a JSON string into a JavaScript object:
var obj = eval (“(” + text + “)”);
JSON is not a document format and this is not a markup language. Even, this is not a general serialization format in that it does not have a direct representation for cyclical structures, although it can support a meta representation that does.
JSON is not extensible and it does not need to be. It can represent any non-recurrent data structure as it is. JSON is a flexible as new fields can be added to existing structures without obsoleting existing programs.
In this sense, XML is also not extensible. This is possible to add new tags and attributes, but this is not possible to extend XML to add expressive syntax for arrays and objects and numbers and booleans.
Based on United States, Jacob Frazier is a skilled JavaScript developer with over 8 years of experience. He is passionate about change and trying new things, both professionally and personally. He loves startups and is extremely proactive.
You may need access to a printer, scanner, webcam, or dongle connected to another computer.…
In today's fast-paced digital world, the logistics and supply chain sector is encountering unprecedented challenges…
Website navigation and speed play a significant role in the success of online business. Attractive…
Welcome to your ultimate guide to Jackpot joy, the crown jewel of UK online casinos!…
The demand for mobile apps has risen rapidly. The reason? The modern customers proactively rely…
In recent years, a significant shift has occurred in the automotive industry as electric vehicles…
View Comments
This is the right web site for everyone who wishes to find out about this topic. You know a whole lot its almost hard
to argue with you (not that I actually would want to? HaHa). You certainly put a fresh spin on a topic that has been written about for years.
Great stuff, just excellent!