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 do I install laravel, talk about the different ways?

0 Answers  


What is bearer token?

0 Answers  


What is database migration used in laravel 5? Explain

0 Answers  


How can we handle Error Handling in Laravel ?

1 Answers  


How to generate a controller with resources in laravel?

0 Answers  


List some official packages provided by laravel?

0 Answers  


Explain the directory structure of laravel 5.6.

0 Answers  


How to get Retrieving a Cookie in Laravel ?

1 Answers  


What are the Severity Levels in Laravel ?

1 Answers  


What is a Restful Resource Controllers ?

0 Answers  


Explain some features of laravel?

0 Answers  


What are Uses While Using the properties of Request instance ?

0 Answers  


Categories