
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
simple-get-json
Advanced tools
(see also licenses for dev. deps.)
getJSON function similar to that of jQuery's.
If no callback or error-back is provided (or when an array of URLs is supplied), a promise will be returned. If an array is provided along with a callback, that callback will be executed before the promise is resolved.
You may use the file index-es.js to use the ES2017 await keyword for
Promise results, as well as take advantage of ES6 Module import:
try {
const [urlObj1, urlObj2] = await getJSON([url1, url2]);
} catch (err) {
// Handle errors here
}
simple-get-json also accepts an array of URLs (waiting for all to load):
const [obj1, obj2] = await getJSON([url1, url2]);
// Do something with "obj1" and "obj2"
Alternatively, you can use regular then Promises:
getJSON([url1, url2]).then(function (objsArr) {
// Do something with "objsArr" array
}, function (err) {
// Handle any errors here
console.log('err', err);
});
Or use the old callback style.
getJSON(url, function (data) {
// Do something with "data"
});
An optional third argument can be provided as an error-back (which will be supplied the error message and originally supplied URL).
npm install simple-get-json
<!--
For older browser support
<script src="node_modules/core-js-bundle/minified.js"></script>
-->
<script src="node_modules/simple-get-json/dist/index.js"></script>
getJSON(...args);
or for ESM:
import {getJSON} from './node_modules/simple-get-json/dist/index-es.js';
import {getJSON} from 'simple-get-json';
const {getJSON} = require('simple-get-json');
See below for buildGetJSON usage.
In ESM Node, you can:
import {getJSON} from 'simple-get-json';
getJSON which works relative to the current file
(or some other URL):import {buildGetJSON} from 'simple-get-json';
const getJSON = buildGetJSON({
baseURL: import.meta.url
});
OR:
getJSON which works relative to a specific file
directory:import {buildGetJSON} from 'simple-get-json';
const getJSON = buildGetJSON({
cwd: '/some/current/working/directory'
});
FAQs
getJSON function similar to that of jQuery's for Node or the browser
The npm package simple-get-json receives a total of 3 weekly downloads. As such, simple-get-json popularity was classified as not popular.
We found that simple-get-json demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.