-4

I have this JSON response:

object(stdClass)#1 (2) {
  ["data"]=>
  array(47) {
    [0]=>
    object(stdClass)#2 (4) {
      ["id"]=>
      int(341)
      ["competition_id"]=>
      int(1)
      ["name"]=>
      string(9) "2015/2016"
      ["active"]=>
      bool(true)

But I don't know how to parse the data.

I tried it with this PHP code:

echo $json->data[0]->id;

But it doesn't work. How can I get the ID for example?

Rizier123
  • 58,877
  • 16
  • 101
  • 156
WEBGONDEL UG
  • 147
  • 1
  • 2
  • 12

1 Answers1

-1

here is my solution:

$json = file_get_contents($url);

$json2 = json_decode($json);

echo $json2->data[0]->id;

sorry for complication, the goal was the json_decode() function, after that I can get the data with "->"

greetings!

WEBGONDEL UG
  • 147
  • 1
  • 2
  • 12