JSON is basically used when we want to send back data to the client server. JSON ENCODE means if the data type is in array format then it actually turns into JSON OBJECT, and JSON DECODE is vice versa to the JSON encode.
here I can show you a small example of JSON ENCODE
$data = array(
‘name’ => ‘anwesha’,
‘gender’ => ‘Female’,
‘address’=>’agarpara’
);
$json = json_encode($data);
this way $data which is array datatype turns into JSON object
here is also one small example of JSON DECODE
$json = “{ ‘anwesha’: ‘Female‘ }”;
json_decode(json);
json_decode(json);
in this way $json turns into json array.
Anwesha Chakraborty
Subscriber
Web Developer at Openweb Solutions