I am completely new to Node.js. I have to read specific value from a API responded Nested JSON. I have tried to figure out but getting Undefined instead of the value. Whenever I am trying to read the base object I am getting the responded value but whenever I am trying to read the object under array then I am getting Undefined value.
Code Snippet:
var https = require('https');
var optionget = {
  host: 'api-dev.dataoverflow.com',
  port: 443,
  path: '/test1/test2/',
  method: 'GET',
  HEADERS: {
    'Authorization': 'Basic grege==',
    'X-PruAppID : '
    PlainCardPortal '
  }
};
console.info(optionsget)
var reqGet = htttps.request(optionsget, function(res) {
  console.log("statusCode: ", res.statusCode);
  res.on('data', function(d) {
    process.stdout.write(d);
    process.stdout.write(jsonobj);
    var Value = jsonobj.items.item.topping.type;
    console.log(Value)
  });
});
reqGet.end();
reqGet.on('error', function(e) {
  console.error(e);
});
var optionsgetmsg = {
  host: 'api-dev.dataoverflow.com',
  port: 443,
  method: 'GET'
};
console.info(optionsgetmsg);
var reqGet = https.request(optionsget, function(res) {
  console.log("statusCode: ", res.statusCode);
  res.setEncoding('utf-8')
  res.on('data', function(data) {
    process.stdout.write(data);
  });
});
reqGet.end();
reqGet.on('error', function(e) {
  console.error(e);
});
Nested JSON Snippet:
{
    "items":
        {
            "item":
                [
                    {
                        "id": "0001",
                        "type": "donut",
                        "name": "Cake",
                        "ppu": 0.55,
                        "batters":
                            {
                                "batter":
                                    [
                                        { "id": "1001", "type": "Regular" },
                                        { "id": "1002", "type": "Chocolate" },
                                        { "id": "1003", "type": "Blueberry" },
                                        { "id": "1004", "type": "Devil's Food" }
                                    ]
                            },
                        "topping":
                            [
                                { "id": "5001", "type": "None" },
                                { "id": "5002", "type": "Glazed" },
                                { "id": "5005", "type": "Sugar" },
                                { "id": "5007", "type": "Powdered Sugar" },
                                { "id": "5006", "type": "Chocolate with Sprinkles" },
                                { "id": "5003", "type": "Chocolate" },
                                { "id": "5004", "type": "Maple" }
                            ]
                    },
                    ...
                ]
        }
}
I want to read type : Glazed from this JSON only but I am getting Undefined.  
 
    