Ad
How To Read JsonResponse In Php
How to get id from here
JsonResponse {#457 ▼
#data: "{"bill":{"id":11,"invoice_no":"9m36r9_1459170388239"}}"
#callback: null
}
I am getting this output from this laravel code
return Response::json($response);
I tried json_decode
but not worked here, a blank output is coming.
Thanks for any help.
Ad
Answer
Try like this
$jsonResponse = Response::json([
'id' => 1,
'test' => 'test'
]);
$content = $jsonResponse->getContent();
$array = json_decode($content, true);
$id = $array['id']
Ad
source: stackoverflow.com
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
Ad