Why JSON or XML exists? What is the problem it is trying to solve?

Manoj Mohan
Jan 9 · 1 min read

For explanation we can take JSON.

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate.” — www.json.org

Time for an example,

Let’s say we run two programs in our computer

  1. A Javascript program.
  2. A Java Program.

Now we want to maintain a configuration file which will be accessed by both of these programs.

In this case if you use a .js file and put javascript datatype only your JS program would be able to read it. The same goes for JAVA if you have a .java file.

Since you want programs of different programming language to access same data you need a standard way of representing it, And that is the problem JSON or XML is trying to solve.

It is basically, an intermediate structure between programming languages.

This is the same reason in web programming where your client is a mostly a JS program and your server can be any server side programming language.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade