获取JSON参数PHP

I am new to JSON and I am facing some difficulties , i am doing an echo $response; and i am getting:

    { "items": [ { "tableName": "CO.Affected_Country", "count": 1, "columnNames": [ "id" ], "rows": [ [ "12" ] ] } ], "links": [ { "rel": "self", "href": "https://ter.ge.com/services/rest/connect/v1.3/queryResults?query=x" }, { "rel": "canonical", "href": "x" }, { "rel": "describedby", "href": "x", "mediaType": "application/schema+json" } ] } 

i am trying to get the 'row' value , so i am trying to use $response->{"items"}->{"row"}; I know this syntax is wrong , but how can i do it?

$obj = json_decode($response);
$rows = $obj->items[0]->rows[0];

This is an array. To get the first value (12), you can then do:

echo $rows[0]

Live demo

Use json_decode($response) so:

$data = json_decode($response);
$data->items->row; // or $data['items']['row']

Use json_decode($response) to use json as an object

$data = json_decode($response);

or if you want to use it as array, put true after reponse variable

$data = json_decode($response, true);

try this

$data = json_decode($response, true);

echo $data["items"][0]["tableName"];

Try This

$data = json_decode($response);
echo $data["items"][0]["tableName"];