Introduction to JSON

You can think JSON as a textual way of representing data. It has now become the de facto data-interchange format. JSON is used for communication between server side technologies and mobile app or website.

What is JSON

  • The full form of JSON is "JavaScript Object Notation."
  • Even though the syntax of JSON is similar to JavaScript, but JSON is language independent.
  • It is considered as an alternate of XML for data interchange format.
  • Apart from using it as a data interchange format, it is now used to store data in the database. For example- MongoDB uses JSON to store data in the documents.
  • JSON is not a programming language. It is just a format for exchanging data over the internet.
  • JSON is supported by a majority of programming languages such as Python, JavaScript, Java, Ruby, PHP, C#, etc.
  • MIME type of JSON is application/json.

JSON vs XML

Both JSON and XML are data-interchange format but still possess some differences which are listed below-

JSON XML
JSON is short and lightweight. XML is heavy and verbose.
JSON is simple to read, write and understand. XML is less simple to read, write and understand.
JSON stands for JavaScript Object Notation. XML stands for Extensible Markup Language.
JSON is data based. XML is document based.
File extension of JSON data is .json. File extension of XML data is .xml.
JSON is parsed with the help of functions present in programming languages. XML requires XML parser to parse it.
Array is supported by JSON. Array is not supported by XML.