JSON is a syntax for storing and exchanging data.
What is JSON?
- JSON is a lightweight data-interchange formatted string written in key value pair
- JSON is “self-describing” and easy to understand
- JSON is language independent
Why use JSON?
As the JSON format is lightweight text only, it can simply be sent to and from a server, and used as a data format by any programming language.
While exchanging the data between a browser and server, the data can only be text.
Output (Before json code execution):-
Output (After json code execution the user will be redirected to demo.php):-