Q:

Why am I getting an "undefined" entry when building a JSON response?

I tried the below code. The POSTMAN and console response is:

"undefined[object Object],[object Object],[object Object],[object
  Object],[object Object],[object Object],[object Object],[object
  Object],"

I want the correct JSON output:
    exports.getIssues = function(req, res) {
        console.log(filename + '>>get Issues>>');
        var response = {
            status: Boolean,
            message: String,
            data: String
        };
        var request = require('request');
        var username =
            const.username;
        var password =
            const.password;
        var options = {
            url: 'https://computenext.atlassian.net/rest/api/2/search?jql=status+%3D+Resolved+ORDER+BY+updated',
            auth: {
                username: username,
                password: password
            }
        };

        request(options, function(error, obj) {
            if (error) {
                response.message = appmsg.DATA_NT_FOUND;
                response.status = false;
                response.data = obj;
                res.send(response);
            } else {
                response.message = appmsg.DATA_FOUND;
                response.status = true;
                response.data = JSON.parse(obj.body);
                //res.send(response);
                var issueKey = response.data.issues;

                // var keyData = issueKey[0].key;
                // console.log(response.data.issues);
                // console.log(keyData);
                var output = [];
                for (var i = 0; i < issueKey.length; i++) {
                    var issue = issueKey[i].key;
                    //var key = [];
                    //key.push(issue);
                    console.log(issue);

                    var respon = {
                        status: Boolean,
                        message: String,
                        data: String
                    };
                    var request = require('request'),
                        username =
                        const.username,
                        password =
                        const.username,
                        url = "https://computenext.atlassian.net/rest/api/2/issue/" + issue,
                        auth = "Basic " + new Buffer(username + ":" + password).toString("base64");

                    //console.log(url);
                    request({
                        url: url,
                        headers: {
                            "Authorization": auth
                        }
                    }, function(err, object) {
                        if (object) {

                            var info = object;
                            output.push(info); // this is not working as ouput is undefined at this    point
                            //var pout = JSON.parse(output);
                            //console.log(info);
                            console.log("==============================================================================");
                            //console.log(output);
                            console.log("******************************************************************************");
                            if (issueKey.length === output.length) {
                                respon.message = appmsg.DATA_FOUND;
                                respon.status = true;
                                respon.data = output;
                                //console.log(output);
                                //res.send(respon);

                                var id = issueKey[0].id;
                                console.log(id);

                                var commitout = [];
                                for (var i = 0; i < issueKey.length; i++) {
                                    var commits = issueKey[i].id;
                                    console.log(commits);

                                    var request = require('request'),
                                        username =
                                        const.username,
                                        password =
                                        const.password,
                                        url = "https://computenext.atlassian.net/rest/dev-status/1.0/issue/detail?issueId=" + commits + "&applicationType=stash&dataType=repository",
                                        auth = "Basic " + new Buffer(username + ":" + password).toString("base64");

                                    //console.log(url);
                                    var test = [];
                                    request({
                                        url: url,
                                        headers: {
                                            "Authorization": auth
                                        }
                                    }, function(err, obj1) {
                                        if (obj1) {
                                            var info1 = obj1;
                                            commitout.push(info1);
                                            var resultdone = [];
                                            if (issueKey.length === commitout.length) {
                                                respon.message = appmsg.DATA_FOUND;
                                                respon.status = true;
                                                respon.data = commitout;
                                                // console.log(commitout);
                                                //var test = merge(output, commitout);
                                                //var text = output.body[0]; 

                                                resultdone.push = output + commitout;
                                                console.log(resultdone);
                                                res.send(resultdone);
                                            }
                                        }
                                    });
                                }

                            }
                        }

                    });

                }
            }

        });

    };

A:

What are you trying to do here: resultdone.push = output + commitout;
This concatenates your arrays, hence the [object object]s. Also Why are you assigning it to resultdone.push? I think you actually want to call the method.
Try this instead:  
resultdone.push(commitout.concat(output ))

