1.0.7 • Published 7 years ago
get-json-promise v1.0.7
Get json promise
Tiny module for getting JSON from a URL as a promise. Will only work where the XMLHttpRequest exists, which is not native in e.g. nodejs. It also does not include any promise library - so it may not work in older browsers.
Install
npm require --save get-json-promise
Usage
var jsonPromise = require('get-json-promise');
var url = 'http://localhost:8080/package.json';
jsonPromise(url).then(function(data) {
console.log(data);
// Returns object JSON.parse
});
Example in a HTML page:
See index.html
MIT © Dennis Iversen