如何用 laravel 注释将数组“[]”括号大摇大摆地放置?

How to put array "[ ]" brackets in swagger with laravel comment?

我无法在带有数组括号的示例中编写 JSON 代码。

@SWG\Definition(
 *      definition="UserResponse",
 *      @SWG\Property(property="response", example={
 *               "id": 1,
 *               "name": "Raj",
 *               "userprofile": [{
 *                    "email": "raj@gmail.com",
 *                    "phone": "9999999999",
 *               }],  
 *               "updated_at": "2017-03-06 12:03:12",
 *               "created_at": "2017-03-06 12:03:12"
 *             }
 *      ),
 * ),
 */

我想要这种 out using swagger response Output:

{
   "id": 1,
   "name": "Raj",
   "userprofile": [
       {
         "email": "raj@gmail.com",
         "phone": "9999999999",
       }
   ],  
   "updated_at": "2017-03-06 12:03:12",
   "created_at": "2017-03-06 12:03:12"
}

根据上面的代码,我想要这样的输出: 谢谢,

你只需要加上 "{" 花括号 "}" ,因此它会考虑数组 "[]" 括号。

@SWG\Definition(
 *      definition="UserResponse",
 *      @SWG\Property(property="response", example={
 *               "id": 1,
 *               "name": "Raj",
 *               "userprofile": {{
 *                    "email": "raj@gmail.com",
 *                    "phone": "9999999999",
 *               }},  
 *               "updated_at": "2017-03-06 12:03:12",
 *               "created_at": "2017-03-06 12:03:12"
 *             }
 *      ),
 * ),
 */