Hello @kartik,
You'll need to adjust your exception handler (app/Exceptions/Handler.php) to return the response you want.
This is a very basic example of what can be done.
public function render($request, Exception $e)
{
$rendered = parent::render($request, $e);
return response()->json([
'error' => [
'code' => $rendered->getStatusCode(),
'message' => $e->getMessage(),
]
], $rendered->getStatusCode());
}