Android Parsing Using Php Generated Json
I have created a php script and pick it up with java but im having trouble converting it to a format that i can use. php
Solution 1:
Try this way to creating the associative array in php,
<?php$object=array();
$i=0;
while($i<10){
$employee = array("name"=>"hassan", "Designation"=>"Software Engineer");
$i++;
$object[]=$employee;
}
$orginal["data"]=$object;
echo json_encode($orginal)
?>
OUTPUT WILL BE
{"data":[{"name":"hassan","Designation":"Software Engineer"},{"name":"hassan","Designation":"Software Engineer"},{"name":"hassan","Designation":"Software Engineer"},{"name":"hassan","Designation":"Software Engineer"},{"name":"hassan","Designation":"Software Engineer"},{"name":"hassan","Designation":"Software Engineer"},{"name":"hassan","Designation":"Software Engineer"},{"name":"hassan","Designation":"Software Engineer"},{"name":"hassan","Designation":"Software Engineer"},{"name":"hassan","Designation":"Software Engineer"}]}
Post a Comment for "Android Parsing Using Php Generated Json"