Marian Rick
Marian Rick

Reputation: 3430

How to look into a external JSON file?

I got an URL, for example https://mycustomjson/<api token>/result?=vars. I want to import this JSON file into my wordpress site.

While I got the API token to access the data, I do not know how to generate HTML out of it. I know there is a .getJSON() function in jQuery.

Is there a way to just display the JSON file to find out, which information are stored in it (and how they are labeled/named? I cannot just open the URL in my browser.

Upvotes: 0

Views: 59

Answers (1)

Chris Lear
Chris Lear

Reputation: 6742

Something like this, maybe

jQuery.getJSON( "https://mycustomjson/<api token>/result?=vars" , function(data) {console.log(data)} );

All that does is write the content of data to the console. Open your browser's javascript console to see it. (See eg https://webmasters.stackexchange.com/questions/8525/how-to-open-the-javascript-console-in-different-browsers)

Upvotes: 3

Related Questions