For explanation we can take JSON.
Time for an example,
Let’s say we run two programs in our computer
- A Java Program.
Now we want to maintain a configuration file which will be accessed by both of these programs.
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.