title: Angular2 to export/download json file
body: <p>I am using angular 2. I want to give functionality to download JSON file.</p>
  
  <p>Like i have response with res = {bar : foo} then i want to create json file which will contain this response which can be download on button/anchor click.</p>
  
  <p>Any help will be greatly appreciated. </p>