How to Convert string response to array laravel

You should use json() method or object() method on your response variable. API Reference

json method: Get the JSON decoded body of the response as an array or scalar value.
object method: Get the JSON decoded body of the response as an array or scalar value.

Usage:

$response = Http::get("www.api.com/...");
$decodedBody = $response->json();

OR

$decodedBody = $response->object();

EDIT:
All available methods are listed in the documentation.

Leave a Comment