Skip to content
  • Facebook
GeekCer Logo

GeekCer

The geek's Coding education and Review centre

  • Home
  • Tutorials
    • Java
    • Servlet
    • JSP
    • Python
    • C Tutorial
    • Spring
    • Spring Boot
    • MongoDB
    • Hibernate
    • Data Structure
  • General Knowledge
  • Biography
  • Grammar
  • Festival (त्योहार)
  • Interview
  • Differences
  • Important
  • Toggle search form

Home » Important » JSON The Data Interchange Standard Format

  • World Environment Day in Hindi : Objective, Importance, Theme
    World Environment Day in Hindi : Objective, Importance, Theme General Knowledge
  • Real life Inspirational Stories in Hindi | Success story in Hindi
    Real life Inspirational Stories in Hindi | Success story in Hindi Biography
  • Hima Das Biography | भारतीय धाविका हिमा दास का जीवन परिचय
    Hima Das Biography | भारतीय धाविका हिमा दास का जीवन परिचय Biography
  • Fundamental Rights of Indian Citizens
    Fundamental Rights of Indian Citizens | मौलिक अधिकार क्या हैं? General Knowledge
  • Farmers Day
    National Farmers Day in Hindi | राष्ट्रीय किसान दिवस पर निबंध | चौधरी चरण सिंह जयंती General Knowledge
  • Vedaant Madhavan Biography in Hindi, Family, School, Age
    Vedaant Madhavan Biography in Hindi, Family, School, Age Biography
  • National Doctors Day in India and Other Countries, July 1, 2022
    National Doctors Day in India and Other Countries, July 1, 2022 General Knowledge
  • What is Pronoun?
    What is Pronoun with example? Pronoun definition and examples Grammar

JSON The Data Interchange Standard Format

Posted on September 20, 2021October 4, 2021 By GeekCer Education No Comments on JSON The Data Interchange Standard Format
JSON The Data Interchange Standard Format

JSON is a lightweight data format in which we store information in an organized manner. We can access the data JSON format easily.

The full form of JSON is JavaScript Object Notation. The JSON text format does not depend on any programming language. It is programming language independent. We can use this data format in C, C++, C#, Java, JavaScript, Perl, Python and many other languages.

JSON is a collection of name-value pairs, which means we store information as name-value pairs. Most programming languages today support the JSON data structure. These days we are transferring huge amount of data. And the JSON format is the best data structure for this purpose.

Table of Contents

  • Why should we use JSON?
    • Where does the JSON file come from?
  • Rules for writing JSON format
  • Example of JSON format file
    • Syntax of JSON format
    • How to open JSON format file?
  • Data Types in JSON
    • 1) Number
    • 2) String
      • Special characters that we can use in strings of a JSON document
    • 3) Boolean
    • 4) Object (JSON Objects)
    • 5) Array
    • 6) Null
  • Difference between JSON and XML
    • JSON format
    • XML format

Why should we use JSON?

  • JSON format is easy to read and write.
  • The syntax of JSON is very simple and very straightforward.
  • All major JavaScript frameworks support JSON, so you don’t need to worry about it if you’re using a framework.
  • Most importantly, it is language independent. If you have idea about JSON then you can work with JSON in any programming language.
  • JSON supports arrays, objects, strings, numbers, and values.

Where does the JSON file come from?

JSON was derived from the JavaScript programming language. But most of the programming languages nowadays have a generator and parser of JSON format data.

Rules for writing JSON format

  • You should write the information in name-value pairs like {“Company”:”Geeks Company”}.
  • You should use colon (‘:’) to separate name and value.
  • If you have multiple data then you should separate the data using comma (“,”).
  • If you are preparing data in JSON format, it means you are creating JSON object. You should use curly braces to enclose objects.
  • If you need array of data you should use square brackets.
  • The JSON format does not allow commas at the end of the last pair-value pair. If you try to add at the end it will come under syntax error of JSON format.

If you are creating JSON information and want to put it in a file, you should have the extension .json. .json extension is not mandatory you can have .txt also.

You can learn Agile Methodology of Software Development.

Example of JSON format file

We are taking example of JSON file which will contain employee information which includes name and email.

Syntax of JSON format

Employee.json

                  {"employees":[  
    {"name":"BLAKE", "email":"blake@gmail.com"},  
    {"name":"CLARK", "email":"clark@gmail.com"},  
    {"SMITH":"John", "email":"smith@gmail.com"},
    {"TURNER":"John", "email":"turner@gmail.com"}   
]}  

How to open JSON format file?

You can open the JSON file with any text editor like Notepad, Notepad++ etc. If you want to view formatted data you can open json file in Mozilla Firefox (as it is widely used).

How to open JSON file?

Data Types in JSON

The following are the important data types JSON we use frequently:

1) Number

We can use this data type if we want to use a real number, an integer or a temporary number.

                  { "age" : 25 }

2) String

If we want to write 0 or more Unicode characters then we can write inside double quotes. And we can also write the escaping character inside double quotes.

                  { "name" : "Mark" }

Special characters that we can use in strings of a JSON document

#CharactersDescription
1“”double quotation
2\back slash
3/forward slash
4bbackspace
5fform feed
6nnew line
7rcarriage return
8thorizontal tab
9ufour hexadecimal digits

3) Boolean

This data type represents either true or false values. Apart from this data type will not support.

                  {"active" : "true"}

4) Object (JSON Objects)

It is a collection of name-value pairs separated by commas and placed inside curly brackets.

                  {
"employee":{ "name":"Clark", "age":31, "city":"New York" }
}

5) Array

We enclose the sequence of values in square brackets. And we also separate each value with a comma.

                  {
"employees":[ "Mark", "Clark", "Smith" ] 
}

6) Null

It represents the empty value. Sometimes we do not have value to hold, in which case we use null .

                  { "lastname" : null }

Difference between JSON and XML

#JSONXML
1JSON stands for JavaScript Object Notation.XML stands for eXtensible Markup Language.
2JSON object has data type.XML data is type less. It does not have data type.
3JSON types may be string, number, array, Boolean etc.But in XML, data should be in string format.
4JSON is easy to learn and simple to read and write. XML is less easy than JSON and less simple than JSON.
5JSON is data-oriented.But XML is document-oriented.
6JSON supports array concept.But XML does not support array.
7JSON is less secured as compared to XML.It is more secure than JSON.
8You can parse JSON by a standard JavaScript function. But you can parse XML with an XML parser.
9JSON files are more human readable than XML.XML files are less human readable than JSON.
10JSON does not support comments.But XML support comments.

JSON format

                  {"Cricketers":[
  { "firstName":"Virat", "lastName":"Kohli" },
  { "firstName":"Kane", "lastName":"Williamson" },
  { "firstName":"M.S.", "lastName":"Dhoni" }
]}

XML format

                  <Cricketers>
  <Cricketer>
    <firstName>Virat</firstName> 
    <lastName>Kohli</lastName>
  </Cricketer>
  <Cricketer>
    <firstName>Kane</firstName> 
    <lastName>Williamson</lastName>
  </Cricketer>
  <Cricketer>
    <firstName>M.S.</firstName> 
    <lastName>Dhoni</lastName>
  </Cricketer>
</Cricketers>

JSON was initially developed to meet the need for stateless, server-to-browser communication without using browser plugins.

In conclusion, Hope you guys understood the basics about JSON file format. And in this article we have also covered the syntax of JSON with supported data type, example of JSON. Apart from this, you also got an idea of the difference between JSON and XML which are two different types of file formats.

Share this:

  • Click to share on Facebook (Opens in new window)
  • Click to share on WhatsApp (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • More
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Pinterest (Opens in new window)

Also Read

Important Tags:Data Types, Difference between JSON and XML, JSON Format, Language Independent, String, XML

Post navigation

Previous Post: Agile Methodology of Software Development
Next Post: Design Pattern in Software Engineering

More Related Articles

Different Types of Loans in India, Eligibility, Documents, Benefits Different Types of Loans in India, Eligibility, Documents, Benefits Important
Difference between Git Merge and Git Rebase | Git Rebase vs Git Merge Difference between Git Merge and Git Rebase | Git Rebase vs Git Merge Differences
Linux Commands With Example | Linux commands cheat sheet Linux Commands With Example | Linux commands cheat sheet Important
What is Agriculture Agriculture (कृषि) से जुड़े महत्वपूर्ण प्रश्न और उत्तर Important
Difference between Bugs, Errors and Issues in Software Testing Difference between Bugs, Errors and Issues in Software Testing Important
Design Pattern in Software Engineering Design Pattern in Software Engineering Important

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • National Farmers Day in Hindi | राष्ट्रीय किसान दिवस पर निबंध | चौधरी चरण सिंह जयंती
  • Human rights day in Hindi: 10 दिसंबर ह्यूमन राइट्स डे
  • Unicef day is celebrated on December 11 | Speech on unicef day
  • Indian Navy Day: जल सेना दिवस कब और क्यों मनाया जाता है?
  • P V Sindhu Biography in Hindi, Badminton, State, Caste पी. वी. सिंधु जीवन परिचय, कहानी, राज्य, जाति
  • Draupadi Murmu Biography In Hindi | द्रौपदी मुर्मू की जीवनी
  • Similarities and difference between OSI and TCP/IP model
    OSI vs TCP/IP Model, Similarities and difference between OSI and TCP/IP model Networking
  • IPv4 Vs IPv6 | Difference between IPv4 and IPv6
    IPv4 Vs IPv6 | Difference between IPv4 and IPv6 Differences
  • OSI Model | 7 Layers of OSI Model in Computer network
    OSI Model | 7 Layers of OSI Model in Computer network, Functions Networking
  • TCP/IP Model, Full Form, Layers and their Functions
    TCP/IP Model, Full Form, Layers and their Functions Networking
  • Difference between TCP and UDP
    Difference between TCP and UDP | TCP vs UDP examples Differences
  • Network kya hai (नेटवर्क क्या है)
    Network kya hai (नेटवर्क क्या है) Networking
  • Difference between Internet and Intranet
    Difference between Internet and Intranet Differences
  • Java Tutorial
  • Servlet Tutorial
  • JSP Tutorial
  • Maven Tutorial
  • HTML Tutorial
  • Programs
  • Hindi/English Grammar
  • Difference Between ... and ...
  • HR Interview
  • Important Articles

Write to Us:
geekcer.code@gmail.com

  • About Us
  • Privacy and Policy
  • Disclaimer
  • Contact Us
  • Sitemap

Copyright © GeekCer 2022 All Rights reserved