I have an array like this,
Array
(
[0] => 1
[1] => naveen
)
Array
(
[0] => 2
[1] => bos
)
I am using a csv upload to insert data's to the mongodb
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
echo "<pre>";
print_r($data);
echo "</pre>";
}
i want to convert the array into a json format, i have tried the json_encode($data); but it is coming like this
["1","naveen"]
["2","bos"]
What i want to do make this array as json encoded format
json_encode.