Skip to content
forked from azer/get-json

Get JSON docs on both Node and Browsers

License

Notifications You must be signed in to change notification settings

ljharb/get-json

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

get-json

Cross-platform library for getting JSON documents. Wraps request on Node, fallsback to JSONP on browsers.

$ npm install get-json

Usage

var getJSON = require('get-json')

getJSON('http://api.listenparadise.org', function(error, response){

    console.log(error);
    // undefined

    console.log(response);
    // ["Beth Orton — Stolen Car",
    // "Jack White — Temporary Ground",
    // "I Am Kloot — Loch",
    // "Portishead — Glory Box"]
});

Alternatively, you can use a Promise:

var getJSON = require('get-json')

getJSON('http://api.listenparadise.org')
    .then(function(response) {
      console.log(response);
    }).catch(function(error) {
      console.log(error);
    });

About

Get JSON docs on both Node and Browsers

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Languages

  • JavaScript 100.0%