All you need to know about JSON API

All you need to know about JSON API

Posted under Company , Developer on November 9, 2017

Gone are the days when web services were using XML to transmit data and used XML as the primary data format. Since JSON has documented, it has captured the world of transmitting data as it is way more lightweight than XML. Also, JSON stands for JavaScript Object Notation and it became popular in the 80’s for being used in video games making in Atari.

The popularity of JSON has only increased and in the next 20 years, it has been found replacing XML (Extended Markup Language) for exchanging data. If we talk about the notations, JSON is written in English language and more readable than other programming languages.

What is JSON all about?

 JSON is a data format and syntax to exchange and store data. When a web browser and a server exchanges data, the data is in text format. Therefore JSON is text. Javascript objects are converted into JSON and send the JSON format to the server. Javascript objects are used this way with data without having the need of complicated translations and parsing of javascript language.

Keys and values are the two primary things that JSON is made of. Basically, in a simple sentence JSON, I comprised of key/value pair.

  • Key – Key is a string that is enclosed inside quotations and it is always a string
  • Value – Values can be anything starting from string to an array, boolean expressions, an array of objects, number, strings, a number, or simply an object.
  • Key-value Pair – JSON notation is like [“key” : “value” ]. So, here key and value make a pair and conjugated with a colon in between. These are comma separated.

Image Source:

In JSON object is depicted as a set of key/value pair which is unordered. Similarly, Array can be written in JSON like –

Image Source:

And values in JSON are –

Image Source:

Example of Sending Data in JSON

Image Source: Script editor of

How is JSON different from XML?

XML and JSON both are used for transfer and receive data to and from web servers. XML and JSON both are having formats that are human readable, use a hierarchical structure that is the value inside value structure, can be used by many programming languages and can be parsed well, can be used with an XMLHTTP Request.

But JSON is not XML. They are different in many ways. The main difference between XML and JSON is a way of parsing. Parsing of XML is very complicated and takes time and it needs XML parser to be parsed. On the other hand, JSON is parsed by JavaScript functions easily and takes lesser time. JSON is parsed into a javascript object which can be used as it is.

This is not the only reason for JSON to be better than XML. JSON is shorter and does not use ending tags, which makes the parsing faster. Also, JSON is faster to read and write than XML tags and it can use arrays for a bunch of objects to define.

When it comes to AJAX applications, JSON works faster and efficiently than XML. To use XML for AJAX, it needs to fetch an XML document, XML Dom to be used to loop through the intended document, then finally extraction and storage of the variables are done from it. On the other hand, it is just a two-step process for JSON. JSON string is just needed to be fetched and parsed and that’s it.

JSON Object vs. JavaScript Object

The name JSON is inspired by javascript object notation but there is a difference between JSON and JavaScript objects. JSON is basically plain text, or we can say string format representation of an object more technically. It can be used by any programming language and not by javascript only. However, it can be converted into a javascript object and used.

Javascript is an object-oriented programming language which is used for client-side scripting. JSON is a data exchange format and not a full-fledged programming language that creates and uses objects. There is nothing like JSON objects. JSON uses strings or text and can be parsed by any programming language to make an object and use.

Here is an example to understand this well:

var a = ‘{“Key” : 123}’ ;   (JSON)

var b = {“Key” : 123} ;      (Java Script)

In the above example, both the variables look same. But, if we look closer, we can notice that ‘a’ is actually a string and it is a JSON string. ‘b’ is javascript object. Both look very similar, thus ‘a’ can be misinterpreted as a JSON object.

Now, we can parse ‘a’ into a java script object using JSON.parse() function:

var c = JSON.parse(a);

What is a JSON API?

If you want to build an API or application program interface in JSON, JSON API is the specification for that. These conventions and specifications are used to increase productivity and efficiency of JSON, your API and over these, your application.  JSON APIs can be used in web development using JAVA, WordPress plugin development which can send WordPress emails etc.

JSON APIs can be customized and built by clients and used to serve specific purposes in a better way. For example: Pepipost has JSON APIs that are built for email services provided to clients.

Pepipost has two types of APIs –

  1. REST API – These APIs accept each parameter as a separate HTTP variable. Example –

Image Source:

  1. JSON APIs – These APIs accept parameters in JSON string format that is provided as a value of a string parameter. Example –

Pepipost APIs help to connect Pepipost to CMS, any application server, blogging platforms like WordPress and sending emails instantly. Developed customized HTTP API can send thousands of emails in just one API call and just once API is sufficient for multiple email addresses. This feature greatly reduces the bandwidth cost of clients. Also, it provides stats of how many emails are sent, spam email numbers and how many emails have been bounced while delivering. This data can be used to analyze the email delivery status of your application.

Example of Pepipost API –

Primary category of this API is Email. This API has three parts – API URL, API Key and Input data. Each call of this API has to be authenticated using unique API key for security purposes. It supports SSL. Inputs values can be entered through parameters defined. This is a hypermedia API and supports response formats like XML, JSON, and SMTP.

Found this blog useful? Please rate us
1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)

Leave a Reply

Notify of

By October 9, 2017

Digital Ocean TIDE 2017: As it happened

Digital Ocean’s TIDE event was an exciting and action packed event attended by developers, marketers,…

Read More

By October 11, 2017

Pepipost is at the Hacktoberfest – Let’s celebrate Open Source

We are at the Hacktoberfest! If you are a developer, an Open Source lover then…

Read More

By October 23, 2017

5 factors to consider before building a Web App

Do you have a great idea of developing a revolutionary web app? Amazing, but how…

Read More