How to export one JSON from Meteor Route?


#1

Hello everyone.

I have a route in meteor, which I want to be able to export a very simple JSON. Any idea how to do this? thank you very much.

The idea is that when you run this route, you download a JSON file with this content.

Router.route('/export-json-example/', function(){
  
  var json = {
                  "id_usuario": "6LYRTPEAAAAJ",
                  "autor": "Marcelo Mendoza",
                  "imagen_usuario": "/citations?view_op=view_photo&user=6LYRTPEAAAAJ&citpid=1",
                  "institucion": "Universidad Técnica Federico Santa María",
                  "c_campos": 5,
                  "campos": [
                      "Web mining",
                      "online social networks",
                      "social media",
                      "information retrieval",
                      "sentiment analysis"
                  ]
              }
            
  
  this.response.end();
}, { where: 'server' });

Many thanks to all, I hope you can help me, Regards.