I want the following JSON:
{"success": false,"errors": {"err1": "some error","err2": "another error"}}
The code I am using:
$rs = array("success"=>true);
$rs['errors'][] = array("err1"=>"some error");
$rs['errors'][] = array("err2"=>"another error");
json_encode($rs);
produces the following:
{"success":false,"errors":[{"err1":"some error"},{"err2":"another error"}]}