Chapter 5. Response Data

In this Chapter:

Supported Response Formats

The YQL Web Service can return data in either XML, JSON, or JSONP format. The default format is XML. To specify JSON, include the format=json parameter in the URL of the YQL Web service, for example:

http://query.yahooapis.com/v1/public/yql?q=select * from geo.places wheretext=’sunnyvale’&format=json

To specify JSONP, include both the format and callback query parameters. The callback parameter indicates the name of the JavaScript callback function. Here's an example:

http://query.yahooapis.com/v1/public/yql?q=select * from geo.places wheretext=’sunnyvale’&format=json&callback=cbfunc

The format of the response data is not dependent on the format of the original datasource. For example, if a YQL table is backed by a datasource in XML, the YQL Web Service can return data in JSON. For more information, see XML-to-JSON Transformation.

Table of Contents