How to convert null values to empty string in Laravel 5.6 json response?
I have this response from my Laravel 5.6
:
{
"id": 1,
"name": "Test",
"email": "anything@example.com",
"descr": null
}
It comes from this Laravel PHP
code:
public function show($id) {
return Client::find($id);
}
Is there any built-in function in Laravel 5.6 to change the null value to empty sting? I want to get back this json object:
{
"id": 1,
"name": "Test",
"email": "anything@example.com",
"descr": ""
}
Any idea?
from Laravel Questions and Answers https://laravelquestions.com/php/how-to-convert-null-values-to-empty-string-in-laravel-5-6-json-response/
via Lzo Media
No comments:
Post a Comment