如何json编码格式?

i'm trying to get some json print. I have a simple format but i didn't figure it out.

But my result is like that. {"datas":{"title":"table"}}

    $sql = "SELECT * FROM mytable";
    $check = mysqli_fetch_array(mysqli_query($con,$sql));
    $array = array("table"=>$check["title"]);
    $result=json_encode(array('datas' => $array));
    echo($result);
    mysqli_close($con);

I need this is my format {"datas":[{"0":"table","title":"table"}]}

I guess i miss something.

You should use this:

    $sql = "SELECT * FROM mytable";
    $check = mysqli_fetch_assoc(mysqli_query($con,$sql));
    $array = array("table"=>$check["title"]);
    $result=json_encode(array('datas' => $array));
    echo($result);
    mysqli_close($con);