I need this type of json response in PHP
{
"errors": [
{
"message": "Something went wrong!"
}
]
}
Where "errors" is an array, and "message" is encoded in json
If I encode it something like this
json_encode (['errors' => ['message' => 'Unauthenticated.']])
it prints like
{
"errors": {
"message": "Unauthenticated."
}
}
but I want it like above, any proper solution for this?