Q:

PHP json_encode - create JSON array

I've used the json_encode function in the past to create simply JSON objects like this:
$payload =  array ("user" => $username, "password" => $password, "group" => $group);
$payload = json_encode ($payload);

which creates this:
{"user":"john smith","password":"abc12345","group":"sales"}

I now need to generate a JSON array like this:
{
  "query": [
    {
      "Date": "11/01/2017...12/31/2017"
    }
  ]
}

but I can't find the correct syntax.

A:

You can simply create a 2d array in php.
$payload =  array (
    "query" => array(
         array(
             "date" => "11/01/2017...12/31/2017",
             "other sub key" => "other sub value"
         )
    ),
    "other main key" => array(
         array(
             "other sub key" => "other sub value",
             etc...
         )
    )
);

