Détail du package

get-json

ljharb84.8kBSD-3-Clause1.1.0

Cross-platform library for getting JSON docs

JSON, fetch, getJSON

readme

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);
    });

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

v1.1.0 - 2024-06-16

Commits

  • [Refactor] replace phin with a simplified inlined version c649fb5
  • [Refactor] reject earlier when the URL is not a string f2d9797
  • [meta] delete npmignore file acb9430
  • [Dev Deps] update tape 240fc6e

v1.0.2 - 2024-06-14

Merged

  • Revert "Project status: Deprecated" #6
  • Project status: Deprecated #6

Commits

  • [eslint] add eslint cd85915
  • [Tests] migrate from travis to GHA 06132a7
  • [meta] add auto-changelog 057c3d7
  • [meta] use npmignore 51e1da6
  • [meta] clean up package.json ad75a77
  • [Fix] ensure browser fallback returns a Promise 6664a6b
  • [meta] add missing LICENSE file; use correct SPDX license identifier c67a81a
  • [Deps] update jsonp, phin e0b383e
  • [Refactor] use browser field instead of runtime is-node detection acfa556
  • Only apps should have lockfiles b78e799
  • [Tests] switch from prova to tape 686dea6
  • [Tests] move tests into test dir 895e2de
  • [meta] add missing engines.node e0b27f1
  • [meta] update repo b802bf5
  • [meta] ignore < high audit warnings 5156dd2

v1.0.1 - 2018-10-07

Merged

  • remove node-noop #4
  • Promise support #3

Commits

v1.0.0 - 2017-08-17

Merged

  • Use phin instead of Request #2

Commits

v0.0.3 - 2016-04-18

Commits

  • add JSONP fallback d3e1059
  • first commit e7eb512
  • set repo to zeke's fork following #unpublishgate d8e330c
  • Create .travis.yml 0b939cd
  • set repo to zeke's fork following #unpublishgate 336837b