Decoding from Json String
<?php
Decoding from Json String
````````````````````````````````
inorder to decode the entire Json string we can use json_decode()
to convert JSON_STR to native PHP DataType
Syntax:
json_decode(<json_str>,<to array>[default=false]);
Return Type : Object | Array | Key
How to decode the entire Json String to Array
Syntax :
$data=json_decode(<json_str>,true);
echo getType($data); //array
#Iterating through Object
foreach($json_array as $json_obj){
echo $json_obj->key_1;
echo $json_obj->key_2;
echo $json_obj->key_3;
echo $json_obj->key_4;
.......
}
0 Comments