Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How to get JSON Response on Laravel ?



How to get JSON Response on Laravel ?..

Answer / surbhi

JSON response can be sent using the json method.
This method will automatically set the Content-Type header to application/json.
The json method will automatically convert the array into appropriate json response.

Example :

Route::get('json',function(){
return response()->json(['name' => 'Gandhi', 'state' => 'Gujarat']);
});

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Laravel PHP Framework Interview Questions

How to assign a variable value for all view file?

0 Answers  


What is an api route?

0 Answers  


Is any server permissions required for laravel?

0 Answers  


What is the default session timeout duration?

0 Answers  


Tell me how to get current environment in laravel 5?

0 Answers  


What is the use of db facade?

0 Answers  


Explain the types of dependency injection?

0 Answers  


What is contextual binding?

0 Answers  


How to get Retrieving the Request URI ?

1 Answers  


List the requirements to install valet?

0 Answers  


How to configure route cache and clear route cache in laravel?

0 Answers  


Is laravel a good framework?

0 Answers  


Categories