From Robs_Wiki
Revision as of 14:58, 10 February 2020 by Qadmin wiki (talk | contribs) (Rules for JSON syntax)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


For a while, XML (extensible markup language) was the only choice for open data interchange. But over the years there has been a lot of transformation in the world of open data sharing. The more lightweight JSON (Javascript object notation) has become a popular alternative to XML for various reasons. A couple obvious ones are:

  • Less verbose- XML uses more words than necessary
  • JSON is faster- Parsing XML software is slow and cumbersome. Many of these DOM manipulation libraries can lead to your applications using large amounts of memory due to the verbosity and cost of parsing large XML files.

JSON snippet

         "author":"Dennis Ritchie "
         "author":" Bjarne Stroustrup "

Why use JSON ?

•Provide support for all browsers 
•Easy to read and write
•Straightforward syntax
•You can natively parse in JavaScript using eval() function 
•Easy to create and manipulate 
•Supported by all major JavaScript frameworks 
•Supported by most backend technologies
•JSON is recognized natively by JavaScript
•It allows you to transmit and serialize structured data using a network connection. 
•You can use it with modern programming languages.
•JSON is text which can be converted to any object of JavaScript into JSON and send this JSON to the server.

Features of JSON

  • Easy to use - JSON API offers high-level facade, which helps you to simplify commonly used use-cases.‬ ‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬‬
  • Performance - JSON is quite fast as it consumes very less memory space, which is especially suitable for large object graphs or systems.
  • Free tool - JSON library is open source and free to use.
  • Doesn't require to create mapping - Jackson API provides default mapping for many objects to be serialized.
  • Clean JSON - Creates clean, and compatible JSON result that is easy to read.
  • Dependency - JSON library does not require any other library for processing.

Rules for JSON syntax

  • Data should be in name/value pairs
  • Data should be separated by commas
  • Curly braces should hold objects
  • Square brackets hold arrays

Application of JSON

  • Helps you to transfer data from a server
  • JSON format helps transmit and serialize all types of structured data.
  • Allows you to perform asynchronous data calls without the need to do a page refresh
  • Helps you to transmit data between a server and web applications.
  • It is widely used for JavaScript-based application, which includes browser extension and websites.
  • You can transmit data between the server and web application using JSON.
  • We can use JSON with modern programming languages.
  • It is used for writing JavaScript-based applications that include browser add-ons.
  • Web services and Restful APIs use the JSON format to get public data.