Skip to content
robynitp edited this page Nov 13, 2014 · 43 revisions

APIs

Read:

Publishing JSON data

Creating a JSON file

Part of the assignment this week is to publish some JSON data. You don't necessarily have to write the JSON from scratch. If you have data in a spreadsheet, export it as CSV, open the CSV file in Sublime or other text editor, copy the contents, and paste it into this online CSV-to-JSON converter. Then click "Download" or just copy and paste the resulting JSON into a new file and save it with the file extension .json.

If you prefer, you can write JSON from scratch in a text editor, or use the online JSON editing tool, JSON Editor Online.

Publishing JSON

Post your JSON to gist. Gist is a service run by github that lets you post code snippets online; you can log in with your github account. Paste your code, click "Create Public Gist", and you'll see that your code has a URL. From there, you can edit as needed. Notice at the top of the text area, there's a button called "Raw" -- that will give you the URL to the plain JSON, which can be used in Javascript. Be aware that the raw version is specific to a particular revision -- if you update the gist, you'll get a new raw URL.

For example, here's the link to my gist with some json text: https://gist.github.com/robynitp/10153952

... and here's the link to the raw version of the gist: https://gist.githubusercontent.com/robynitp/10153952/raw/f3acabec34265c0956ab0082d0759a8611157488/weather_example.json

Paste the link to your Gist (regular version, not raw) on Class JSON feeds.

#####JSON Tools

Clone this wiki locally