Skip to content

Nested arrays do not JSON-encode properly #200

@LarsKemmann

Description

@LarsKemmann

#39 is closed saying ArrayObject instances are returned from queries by default. However, I still can't do:

echo json_encode($model);

and get out a JSON array for array-type values (especially nested arrays inside the document(s)). I found myself writing this hack to work around it:

$x = array();
$i = 0;
foreach ($model as $k => $v) {
    $x[$i++] = $v;
}
echo json_encode($x));

Help?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions