Attention when passing a plain array to json_encode and using JSON_FORCE_OBJECT. It figured out that the index-order of the resulting JSON-string depends on the system PHP is running on.
$a = array("a" , "b", "c");
echo json_encode($a, JSON_FORCE_OBJECT);
On Xampp (Windows) you get:
{"0":"a","1":"b","2":"c"}';
On a machine running debian I get:
{"2":"a","1":"b","0":"c"}';
Note that the key:value pairs are different!
Solution here was to use array_combine to create a ssociative array and then pass it to json_encode:
json_encode(array_combine(range(0, count($a) - 1), $a), JSON_FORCE_OBJECT);