Hi
I guess it's best to show some example code
$a = array();
echo json_encode($a), "\n";
echo json_encode($a, JSON_FORCE_OBJECT), "\n\n";
$a = array(1,2,3,4,5,6,7);
echo json_encode($a), "\n";
echo json_encode($a, JSON_FORCE_OBJECT), "\n\n";
$a = array(array(1,2,3),array(5,6,7));
echo json_encode($a), "\n";
echo json_encode($a, JSON_FORCE_OBJECT), "\n\n";
$a = array(array("firstname" => "John","lastname" => "Doe","age"=>42 ),array("firstname" => "Jane","lastname" => "Doe","age"=>42 ));
echo json_encode($a), "\n";
echo json_encode($a, JSON_FORCE_OBJECT), "\n\n";
?>
This code results in:
[]
{}
[1,2,3,4,5,6,7]
{"0":1,"1":2,"2":3,"3":4,"4":5,"5":6,"6":7}
[[1,2,3],[5,6,7]]
{"0":{"0":1,"1":2,"2":3},"1":{"0":5,"1":6,"2":7}}
[{"firstname":"John","lastname":"Doe","age":42},{"firstname":"Jane","lastname":"Doe","age":42}]
{"0":{"firstname":"John","lastname":"Doe","age":42},"1":{"firstname":"Jane","lastname":"Doe","age":42}}
Hope this helps
regards
Michel