-1

This is the json format:

{
    "Album": [
        {
            "name": "despacito",
            "lang": "spanish",
            "thumbnail": "some-url",
            "scrn":"some-url",
            "ourl":"some-url",
            "YearOfRelease": 2017
        }
    ]
}

How can this JSON be displayed on a WordPress site. Please do share if there is any tutorial on this or try to help me doing this.

Kirk Beard
  • 9,569
  • 12
  • 43
  • 47
rsk
  • 46
  • 1
  • 8

1 Answers1

0

Using PHP Decode the json object using json_decode($obj) refer : Decoding json in php

{
            "Album": [
                {
                        "name": "despacito",
                        "lang": "spanish",
                        "thumbnail": "some-url",
                        "scrn":"some-url",
                        "ourl":"some-url",
                        "YearOfRelease": 2017
                    }


         ]
         }

to retrieve name, use $obj->Album->name

OR

foreach($obj-> Album as $value){
  echo $value->name; //change accordingly
}

Sources : json_decode to array

Ryan AR
  • 79
  • 1
  • 4