afryingpan
afryingpan

Reputation: 363

Webpage content converted into JSON

In my textbook the URL http://services.faa.gov/airport/status/SFO?format=application/JSON was provided. That link points to a page that provides the content of the original page in JSON format. I want to format another webpage's content into JSON so I tried copying the method used, (Also the link my professor provided for an assignment uses the same format) and I get nothing. http://www.programmableweb.com/apitag/weather?format=application/JSON Clicking the link from here leads to a search of the website via a search engine. Copy pasting that exact same link just takes you to the actual webpage. My question is, why cant I just append ?format=application/JSON to any url for the JSON format of the webpage?

If it matters I'm trying to get JSON data to display via a Chrome extension.

Upvotes: 0

Views: 599

Answers (3)

B.M. Ka.
B.M. Ka.

Reputation: 1

web to json chrome extension you can make it.

Upvotes: -1

Josiah Keller
Josiah Keller

Reputation: 3675

That particular website simply provides a feature where you can get the same data in an alternate format such as JSON. Not all websites provide features like that, and not all of them implement it with the same URL parameter. Some sites may have URLs ending with .html be HTML pages and ones ending with .json provide the same info in JSON. Others might provide a separate API. You might check that website to see if it has a "developers" section that gives information on their API, if they have one.

Upvotes: 1

Quentin
Quentin

Reputation: 944149

My question is, why cant I just append ?format=application/JSON to any url for the JSON format of the webpage?

Because a URL is just data, and there is nothing standard about a query string parameter called "format". The server has to be designed to give you JSON before it can or will do that.

Upvotes: 6

Related Questions