What is JSON?
JSON is the acronym for JavaScript Object Notation. JSON is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. JSON is often used for serializing and transmitting structured data over a network connection.
JSON Data JavaScript?
JSON is text, written with JavaScript object notation. Text is written in the same way as JavaScript object notation.
It is human-readable.
It is easily readable by machines.
It’s like XML, but was designed to be lightweight instead of verbose like XML.
It uses two-key words, unlike XML which uses three-key words.
It does not require start or end tags.
It allows the grouping of data into objects and arrays.
It is language-independent, with implementations in many programming languages.
JSON Data JavaScript? What are the Advantages?
Human-readable text format means it’s easy to read data from JSON files without getting too frustrated. It can be generated with JavaScript programs, so it’s very easy to use in client-side scripting for creating HTML form elements, client-side object models, etc. Has built-in mechanisms for handling objects with the same keys but different values (which XML does not have). Allows you to create hierarchical data structures, which you can’t do with XML (which only allows flat data structures, remember?). Can be generated on the fly without needing to create a whole new document first. This means applications can save bandwidth by generating only the information needed instead of downloading an entire document or page which contains all information upfront. Less error-prone than XML since it does not allow invalid markup unless you tell it to allow it (which you shouldn’t do). Portable – can be used directly in any programming language that supports its base syntax (e.g., no DOM manipulation required). It has a very low learning curve and it’s easy to use simple JSON files for simple things. Most web browsers support reading and writing JSON files natively (e.g., you don’t need a separate parser for this).
JSON Data JavaScript? What are the Disadvantages?
JSON is less verbose than XML, but it still requires more characters than simple key-value pairs used in some data formats. Unless you use JSON with JavaScript, it’s not clear how to deserialize JSON into something else (e.g., if you were to deserialize it into an object in Java, you wouldn’t know if the “name” property is the name of the object or its property). Doesn’t handle circular references very well (e.g., if you had two objects with references to each other, there would be no way to represent that in JSON). Since it does not require start or end tags, there is no way to specify that a value is an array or an object. Since JSON is often used for serializing and transmitting structured data over a network connection, if your network connection breaks your application may not be able to recover from it, since there is no standard way to signal when a JSON document ends. This is different from XML, where if the connection breaks in the middle of an XML document, the document will probably still be mostly valid. If your objects have circular references, then your data may not be compatible with other applications which expect flat data structures. Although most web browsers support reading and writing JSON files natively, not all do, so if you want to support older browsers or non-web browsers, you may need a separate parser for this.
What is JSON Data JavaScript? What are the Shortcomings of XML?
XML was designed for structured data storage and retrieval. It has mechanisms for defining lists and trees of data. However:
It doesn’t work very well for storing small amounts of information into individual objects. It can be verbose when used with small amounts of information into individual objects. XML uses terminologies that are not universally understood by everyone (e.g., what does “element” mean?). It can make simple data look unnecessarily complex. Some XML standards use a lot of unnecessary terminologies which make simple things look overly complicated.
Write a public review