lundi 18 mars 2019

Is there a way to renturn null in json response?

I want to return response with 404 error code and whit null in body, but when I try

response()->json(null, 404);              // return empty object {}
response()->json(json_encode(null), 404); // return string "null"
response()->json(0, 404);                 // return number 0
response()->json(false, 404);             // return false

It is possible to return NULL as json response in Laravel?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire