How to use the json-bigint.parse function in json-bigint

To help you get started, we’ve selected a few json-bigint examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NaturalHistoryMuseum / ckanext-nhm / ckanext / nhm / theme / fanstatic / scripts / apps / vfactor-iiif / src / App.vue View on Github external
).then(response => {
                        // use JSONbig to make sure we parse the enormous ints in the after correctly
                        const jsonData = parseJSON(response.data);

                        // grab the after and total
                        this.after = jsonData.result.after;
                        this.total = jsonData.result.total;

                        // then update the records
                        this.onRecordsChange(jsonData.result.records, isMoreRequest);
                    }).catch(error => {
                        console.log(error);
github node-webot / co-wechat-api / lib / api_common.js View on Github external
}

    var res = await httpx.request(url, options);
    if (res.statusCode < 200 || res.statusCode > 204) {
      var err = new Error(`url: ${url}, status code: ${res.statusCode}`);
      err.name = 'WeChatAPIError';
      throw err;
    }

    var buffer = await httpx.read(res);
    var contentType = res.headers['content-type'] || '';
    if (contentType.indexOf('application/json') !== -1) {
      var data;
      var origin = buffer.toString();
      try {
        data = JSONbig.parse(replaceJSONCtlChars(origin));
      } catch (ex) {
        let err = new Error('JSON.parse error. buffer is ' + origin);
        err.name = 'WeChatAPIError';
        throw err;
      }

      if (data && data.errcode) {
        let err = new Error(data.errmsg);
        err.name = 'WeChatAPIError';
        err.code = data.errcode;

        if ((err.code === 40001 || err.code === 42001) && retry > 0 && !this.tokenFromCustom) {
          // 销毁已过期的token
          await this.saveToken(null);
          let token = await this.getAccessToken();
          let urlobj = liburl.parse(url, true);
github dialogflow / dialogflow-nodejs-client / samples / facebook / src / app.js View on Github external
app.post('/webhook/', (req, res) => {
    try {
        const data = JSONbig.parse(req.body);

        if (data.entry) {
            let entries = data.entry;
            entries.forEach((entry) => {
                let messaging_events = entry.messaging;
                if (messaging_events) {
                    messaging_events.forEach((event) => {
                        if (event.message && !event.message.is_echo) {

                            if (event.message.attachments) {
                                let locations = event.message.attachments.filter(a => a.type === "location");

                                // delete all locations from original message
                                event.message.attachments = event.message.attachments.filter(a => a.type !== "location");

                                if (locations.length > 0) {
github fireworq / fireworqonsole / client / queue-list / Container.tsx View on Github external
public async asyncGetQueueStats(): Promise {
    try {
      const path = '/api/queues/stats';
      const response: Response = await fetch(path, {
        method: 'GET'
      });
      if (response.ok) {
        const stats = snakeToCamel(JSON.parse(await response.text()));
        this.dispatch(statsListRetrieved(stats as StatsList));
      } else {
        throw new Error(`Request to ${path} failed with status code ${response.status}`);
      }
    } catch (err) {
      console.error(err);
    }
  }
github fireworq / fireworqonsole / client / version-list / Container.tsx View on Github external
public async asyncGetNodeVersions(): Promise {
    this.dispatch(fetchStarted());
    try {
      const path = '/api/versions';
      const response: Response = await fetch(path, {
        method: 'GET'
      });
      if (response.ok) {
        const versions = JSON.parse(await response.text());
        this.dispatch(nodeVersionsRetrieved(versions as NodeVersion[]));
      } else {
        throw new Error(`Request to ${path} failed with status code ${response.status}`);
      }
    } catch (err) {
      console.error(err);
    } finally {
      this.dispatch(fetchFinished());
    }
  }
github hjespers / node-red-contrib-teslams / teslams / teslams.js View on Github external
teslams.all( { email: tesla_email, password: tesla_password }, function ( error, response, body ) {
                    var data, vehicle, e;
                    //check we got a valid JSON response from Tesla
                    //util.inspect( 'response is: \n' + response );
                    try { 
                        data = JSONbig.parse(body); 
                    } catch(err) { 
                        console.log('[teslams] Telsa login error: ' + err);
                        outmsg.payload = err;
                        node.send(outmsg);
                    }
                    //check we got an array of vehicles and get the first one
                    if (!util.isArray(data.response)) {
                        util.inspect( data.response );                        
                        e = new Error('expecting an array from Tesla Motors cloud service');
                        util.log('[teslams] ' + e);
                        outmsg.payload = e;
                        node.send(outmsg);
                    } else {
                        vehicle = data.response[0];
                        //check the vehicle has a valid id
                        if (vehicle === undefined || vehicle.id === undefined) {
github fireworq / fireworqonsole / client / new-job / Container.tsx View on Github external
public async asyncPutNewJob(job: any, callback?: () => void): Promise {
    this.dispatch(saveStarted());
    let queueName: string | undefined;
    try {
      const path = '/api/job/' + encodeURIComponent(job.category);
      const response: Response = await fetch(path, {
        method: 'POST',
        body: JSON.stringify(job)
      });
      if (response.ok) {
        const job = snakeToCamel(JSON.parse(await response.text()));
        queueName = job.queueName as string;
        this.dispatch(saveFinished(queueName));
        if (callback !== undefined) callback();
        history.push(pathQueueJobs(queueName));
      } else {
        this.dispatch(saveFinished(undefined));
        throw new Error(`Request to ${path} failed with status code ${response.status}`);
      }
    } catch (err) {
      console.error(err);
    }
  }
}
github mallocator / Elasticsearch-Exporter / drivers / elasticsearch.driver.js View on Github external
verifyOptions(opts, callback) {
        if (opts.source.query) {
            try {
                opts.source.query = JSON.parse(opts.source.query);
            } catch(e) {}
        }
        if (opts.drivers.source == this.id && opts.drivers.target == this.id) {
            opts.target.host = opts.target.host || opts.source.host;
            opts.target.port = opts.target.port || opts.source.port;
            opts.target.index = opts.target.index || opts.source.index;
            opts.target.type = opts.target.type || opts.source.type;
            opts.source.proxy = opts.source.proxy || process.env.HTTP_PROXY || process.env.http_proxy;
            if (opts.source.host != opts.target.host) { return callback(); }
            if (opts.source.port != opts.target.port) { return callback();}
            if (opts.source.index != opts.target.index) { return callback(); }
            if (opts.source.type != opts.target.type && opts.source.index) { return callback(); }
        } else {
            let optSet = opts.drivers.source == this.id ? opts.source : opts.target;
            if (optSet.host) { return callback(); }
        }
github apache / incubator-superset / superset / assets / src / SqlLab / actions / sqlLab.js View on Github external
.then(({ text = '{}' }) => {
        if (!query.runAsync) {
          const bigIntJson = JSONbig.parse(text);
          dispatch(querySuccess(query, bigIntJson));
        }
      })
      .catch(response =>
github apache / incubator-superset / superset / assets / src / SqlLab / actions / sqlLab.js View on Github external
.then(({ text = '{}' }) => {
        const bigIntJson = JSONbig.parse(text);
        return dispatch(querySuccess(query, bigIntJson));
      })
      .catch(response =>

json-bigint

JSON.parse with bigints support

MIT
Latest version published 4 years ago

Package Health Score

71 / 100
Full package analysis