var fs = require('fs'), // needed to read JSON file from disk Collection = require('postman-collection').Collection, Response = require('postman-collection').Response, myCollection; // Load a collection to memory from a JSON file on disk (say, sample-collection.json) myCollection = new Collection(JSON.parse(fs.readFileSync('sample-collection.json').toString())); // iterate through all requests in the collection myCollection.forEachItem(function (item) { // do something with the item console.log(item.name); // iterate through all responses of the item item.responses.each(function (response) { // do something with the response console.log(response.name); // duplicate the response and add it to the item, after changing the name to original name + copy duplicateResponse = new Response(response.toJSON()); duplicateResponse.name = response.name + ' copy'; item.responses.add(duplicateResponse); }); }); // save the collection back to disk fs.writeFileSync('sample-collection-modified.json', JSON.stringify(myCollection.toJSON())); // log items at root level of the collection //console.log(myCollection.toJSON());