我无法在带数组括号的示例中编写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"
* }
* ),
* ),
*/
我希望使用swagger响应输出:
{
"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"
}
根据上面的代码,我想要这些输出: 谢谢,
答案 0 :(得分:1)
你只需要添加“{”花括号“}”,因此它会考虑数组“[]”括号。
@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"
* }
* ),
* ),
*/