Ben Pearce
Ben Pearce

Reputation: 7094

Requesting JSON from a google fusion table SQL API query

I'm querying a google fusion table via the url below and it's returning a csv file. Does anyone know how to get it to return json?

https://www.google.com/fusiontables/api/query?sql=SELECT ROWID FROM <table id>

Upvotes: 1

Views: 2032

Answers (2)

Art
Art

Reputation: 1619

The fusion tables SQL api has an undocumented feature that will allow you to retrieve JSON. So your url would be:

https://www.google.com/fusiontables/api/query?sql=SELECT ROWID FROM <table id>&jsonCallback=<callback function>

Once the fusion tables table api is live it returns JSON by default.

Upvotes: 3

Eric Bridger
Eric Bridger

Reputation: 3794

I don't think this is an option in the Fusion Table API. But CSV is easily parsed in Javascript. The undocumented Fusion Table JSONP API wraps the CSV in JSON creating both columns and rows members.

Upvotes: 1

Related Questions