I have to do a gulp task where am trying to read a json file(array of objects) and I want to write a single object into another file.
json:
    {
    "Files": [{
        "dev": {
            "POIBasePath": "poi",
            "basePathSearch": "search-v1",
            "contentType": "application/json",
            "timeOut": 10000
        }
    }, {
        "qa": {
            "POIBasePath": "poi",
            "basePathSearch": "search-v1",
            "contentType": "application/json",
            "timeOut": 10000
        }
    }]
}
Gulp task:
    gulp.task('readFile', function() {
    return gulp.src('app/dataConfig.json')
        .pipe(fs.readFile("app/dataConfig.json", "utf-8", function(err, data){
            console.log(data);//getting the total json object here
            fs.writeFile('app/scripts/apiConfig.js', data.Files[0].dev);
        }))
        .pipe(gulp.dest('./dest/'))
})
Here when i am trying to access data.Files[0].dev i am getting undefined
Any help would be appreciated
