Phil Hudson
Phil Hudson

Reputation: 3901

Error: Error parsing JSON answer from MailChimp API

Getting an error from the NodeJS MailChimp - using:

https://github.com/gomfunkel/node-mailchimp

Error: Error parsing JSON answer from MailChimp API: �V*.I,)-V�RJ-*�/R�QJ�OIU�220�Q�K�2�|2�K�]�S���K\+��*�j+%ϼ�Ĝ���������jO+SKK�Z��T��c

I do not understand why this is happening, my calls are pretty vanilla, see below:

var MailChimpAPI = require('mailchimp').MailChimpAPI,
    apiKey = 'asaas',
    mainListId = 45949;


try {
    var api = new MailChimpAPI(apiKey, {version: '2.0'});
} catch (error) {
    console.log(error.message);
}



var options = {
    id: mainListId, //12345
    email: {
        email: email //[email protected]
    },
    double_optin: false,
    send_welcome: false
};

console.log(options);

api.call('lists', 'subscribe', options, function (error, data) {
    if (error) {
        console.log(error.message);
        callback(error, null);
    } else {
        console.log(JSON.stringify(data)); // Do something with your data!
        callback(null, data);
    }
});

Upvotes: 0

Views: 631

Answers (1)

TooMuchPete
TooMuchPete

Reputation: 4643

It looks like your client isn't properly uncompressing the gzipped response from MailChimp. You should probably open that as an issue against the library.

Upvotes: 1

Related Questions