Skip to content

Instantly share code, notes, and snippets.

@saylerb
Last active July 11, 2016 18:02
Show Gist options
  • Save saylerb/3fb29a713e2d7ec3b518fa3edf2bcf4b to your computer and use it in GitHub Desktop.
Save saylerb/3fb29a713e2d7ec3b518fa3edf2bcf4b to your computer and use it in GitHub Desktop.

XML - pain to write and parse, but human and machine readable JSON - faster, human and machine readable, maps well to data structures in other langauges Writing JSON - double quotes, wrap it in single ruby JSON & RUBY - JSON.parse(json_string) JSON.generate(some_hash) some_hash.to_json JSON & jQuery = AJAX stuff:

/tweets.json is an endpoint for your application.

$.getJSON('/tweets.json'), function (data) {
  console.log(date);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment