If you want numerical ArrayObject objects to play nice with json_encode(), implement JsonSerializable:
class JsonSerializableArrayObject extends ArrayObject implements JsonSerializable {
function jsonSerialize() {
return $this->getArrayCopy();
}
}
For assoc ArrayObject objects this isn't neccesary, but for numerical arrays it is, otherwise they will be formatted like
{"0":"jaap","1":"karel"}
instead of
["jaap","karel"]