在Parse Meteor.js中将JSON导出为CSV

时间:2017-08-07 20:25:36

标签: javascript json excel csv

我有一个有一个按钮的模板。此按钮将一个当前JSON导出到csv。新的excel显示以前的JSON记录。我正在使用包http://papaparse.com/。问题是JSON的记录,如:

"publicaciones": [
        {
            "titulo_pub": "Information credibility on twitter",
            "authors": "C Castillo, M Mendoza, B Poblete",
            "info": "Proceedings of the 20th international conference on World wide web, 675-684, 2011",
            "citas": "811",
            "año": "2011"
        },
        {
            "titulo_pub": "Twitter Under Crisis: Can we trust what we RT?",
            "authors": "M Mendoza, B Poblete, C Castillo",
            "info": "Proceedings of the first workshop on social media analytics, 71-79, 2010",
            "citas": "607",
            "año": "2010"
        },....

excel显示此[Object Object]。

如果有人可以帮助我。我会很感激的。

tree.html

<div class="col-md-2 col-md-offset-10 col-xs-2 col-xs-offset-3">
  <button type="button" class="btn export">Export to CSV</button>
</div>

tree.js

"click .export":function(){
        var url_2 = window.location.pathname;
        var res_2 = url_2.split("/");
        var id_usuario_s_2 = res_2[2];
        var csvContent = CSV.unparse(Scrapers.find({id_usuario: id_usuario_s_2}).fetch());
        window.open('data:text/csv;charset=utf-8,' + escape(csvContent), '_self');

      }

enter image description here

{
    "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"
    ],
    "c_titulos": 20,
    "publicaciones": [
        {
            "titulo_pub": "Information credibility on twitter",
            "authors": "C Castillo, M Mendoza, B Poblete",
            "info": "Proceedings of the 20th international conference on World wide web, 675-684, 2011",
            "citas": "811",
            "año": "2011"
        },
        {
            "titulo_pub": "Twitter Under Crisis: Can we trust what we RT?",
            "authors": "M Mendoza, B Poblete, C Castillo",
            "info": "Proceedings of the first workshop on social media analytics, 71-79, 2010",
            "citas": "607",
            "año": "2010"
        },
        {
            "titulo_pub": "Query recommendation using query logs in search engines",
            "authors": "R Baeza-Yates, C Hurtado, M Mendoza",
            "info": "Current Trends in Database Technology-EDBT 2004 Workshops, 395-397, 2004",
            "citas": "597",
            "año": "2004"
        },
        {
            "titulo_pub": "Predicting information credibility in time-sensitive social media",
            "authors": "C Castillo, M Mendoza, B Poblete",
            "info": "Internet Research 23 (5), 560-588, 2013",
            "citas": "106",
            "año": "2013"
        },
        {
            "titulo_pub": "Do all birds tweet the same?: characterizing twitter around the world",
            "authors": "B Poblete, R Garcia, M Mendoza, A Jaimes",
            "info": "Proceedings of the 20th ACM international conference on Information and ..., 2011",
            "citas": "103",
            "año": "2011"
        },
        {
            "titulo_pub": "Modeling user search behavior",
            "authors": "R Baeza-Yates, C Hurtado, M Mendoza, G Dupret",
            "info": "Web Congress, 2005. LA-WEB 2005. Third Latin American, 10 pp., 2005",
            "citas": "96",
            "año": "2005"
        },
        {
            "titulo_pub": "Improving search engines by query clustering",
            "authors": "R Baeza‐Yates, C Hurtado, M Mendoza",
            "info": "Journal of the American Society for Information Science and Technology 58 ..., 2007",
            "citas": "70",
            "año": "2007"
        },
        {
            "titulo_pub": "Meta-level sentiment models for big social data analysis",
            "authors": "F Bravo-Marquez, M Mendoza, B Poblete",
            "info": "Knowledge-Based Systems 69, 86-99, 2014",
            "citas": "57",
            "año": "2014"
        },
        {
            "titulo_pub": "Combining strengths, emotions and polarities for boosting Twitter sentiment analysis",
            "authors": "F Bravo-Marquez, M Mendoza, B Poblete",
            "info": "Proceedings of the Second International Workshop on Issues of Sentiment ..., 2013",
            "citas": "57",
            "año": "2013"
        },
        {
            "titulo_pub": "Query clustering for boosting web page ranking",
            "authors": "R Baeza-Yates, C Hurtado, M Mendoza",
            "info": "International Atlantic Web Intelligence Conference, 164-175, 2004",
            "citas": "49",
            "año": "2004"
        },
        {
            "titulo_pub": "Automatic query recommendation using click-through data",
            "authors": "G Dupret, M Mendoza",
            "info": "Professional Practice in Artificial Intelligence, 303-312, 2006",
            "citas": "33",
            "año": "2006"
        },
        {
            "titulo_pub": "Recommending better queries from click-through data",
            "authors": "G Dupret, M Mendoza",
            "info": "International Symposium on String Processing and Information Retrieval, 41-44, 2005",
            "citas": "18",
            "año": "2005"
        },
        {
            "titulo_pub": "Opinion dynamics of elections in Twitter",
            "authors": "F Bravo-Marquez, D Gayo-Avello, M Mendoza, B Poblete",
            "info": "Web Congress (LA-WEB), 2012 Eighth Latin American, 32-39, 2012",
            "citas": "16",
            "año": "2012"
        },
        {
            "titulo_pub": "Identifying the intent of a user query using support vector machines",
            "authors": "M Mendoza, J Zamora",
            "info": "International Symposium on String Processing and Information Retrieval, 131-142, 2009",
            "citas": "16",
            "año": "2009"
        },
        {
            "titulo_pub": "A web search analysis considering the intention behind queries",
            "authors": "M Mendoza, R Baeza-Yates",
            "info": "Latin American Web Conference, 2008. LA-WEB'08., 66-74, 2008",
            "citas": "16",
            "año": "2008"
        },
        {
            "titulo_pub": "A statistical model of query log generation",
            "authors": "G Dupret, B Piwowarski, C Hurtado, M Mendoza",
            "info": "International Symposium on String Processing and Information Retrieval, 217-228, 2006",
            "citas": "13",
            "año": "2006"
        },
        {
            "titulo_pub": "Location cache for web queries",
            "authors": "M Marin, F Ferrarotti, M Mendoza, C Gomez-Pantoja, V Gil-Costa",
            "info": "Proceedings of the 18th ACM conference on Information and knowledge ..., 2009",
            "citas": "12",
            "año": "2009"
        },
        {
            "titulo_pub": "Distributed Ontology-Driven Focused Crawling",
            "authors": "R Campos, O Rojas, M Mar�n, M Mendoza",
            "info": "Parallel, Distributed and Network-Based Processing (PDP), 2013 21st ..., 2013",
            "citas": "10",
            "año": "2013"
        },
        {
            "titulo_pub": "Visual-semantic graphs: using queries to reduce the semantic gap in web image retrieval",
            "authors": "B Poblete, B Bustos, M Mendoza, JM Barrios",
            "info": "Proceedings of the 19th ACM international conference on Information and ..., 2010",
            "citas": "10",
            "año": "2010"
        },
        {
            "titulo_pub": "Building decision trees to identify the intent of a user query",
            "authors": "M Mendoza, J Zamora",
            "info": "Knowledge-Based and Intelligent Information and Engineering Systems, 285-292, 2009",
            "citas": "10",
            "año": "2009"
        }
    ],
    "c_coautores": 21,
    "coautores": [
        {
            "coautor_name": "Barbara Poblete",
            "a_href": "https://scholar.google.cl/citations?user=eZBFWGEAAAAJ&hl=es&oe=ASCII"
        },
        {
            "coautor_name": "Carlos Castillo",
            "a_href": "https://scholar.google.cl/citations?user=D4NJsXEIh1cJ&hl=es&oe=ASCII"
        },
        {
            "coautor_name": "Carlos Hurtado Larrain",
            "a_href": "https://scholar.google.cl/citations?user=SpM8IFkAAAAJ&hl=es&oe=ASCII"
        },
        {
            "coautor_name": "Ricardo Baeza-Yates",
            "a_href": "https://scholar.google.cl/citations?user=v9xULZwAAAAJ&hl=es&oe=ASCII"
        },
        {
            "coautor_name": "Georges Dupret",
            "a_href": "https://scholar.google.cl/citations?user=swZTxxcAAAAJ&hl=es&oe=ASCII"
        },
        {
            "coautor_name": "Felipe Bravo-Marquez",
            "a_href": "https://scholar.google.cl/citations?user=q--XWcQAAAAJ&hl=es&oe=ASCII"
        },
        {
            "coautor_name": "Mauricio Marin",
            "a_href": "https://scholar.google.cl/citations?user=t0-RzjEAAAAJ&hl=es&oe=ASCII"
        },
        {
            "coautor_name": "Alejandro Jaimes",
            "a_href": "https://scholar.google.cl/citations?user=-iy0DxMAAAAJ&hl=es&oe=ASCII"
        },
        {
            "coautor_name": "Juan Zamora",
            "a_href": "https://scholar.google.cl/citations?user=clXFk9YAAAAJ&hl=es&oe=ASCII"
        },
        {
            "coautor_name": "Miguel R. Guevara",
            "a_href": "https://scholar.google.cl/citations?user=n1qKMYwAAAAJ&hl=es&oe=ASCII"
        },
        {
            "coautor_name": "Mauricio Solar",
            "a_href": "https://scholar.google.cl/citations?user=dVZO4RgAAAAJ&hl=es&oe=ASCII"
        },
        {
            "coautor_name": "Dominik Hartmann",
            "a_href": "https://scholar.google.cl/citations?user=rM8qFkwAAAAJ&hl=es&oe=ASCII"
        },
        {
            "coautor_name": "Hernan Astudillo",
            "a_href": "https://scholar.google.cl/citations?user=32ekRVMAAAAJ&hl=es&oe=ASCII"
        },
        {
            "coautor_name": "Daniel Gayo-Avello",
            "a_href": "https://scholar.google.cl/citations?user=bdCROlQAAAAJ&hl=es&oe=ASCII"
        },
        {
            "coautor_name": "Gianmarco De Francisci Morales",
            "a_href": "https://scholar.google.cl/citations?user=R0JCEqMAAAAJ&hl=es&oe=ASCII"
        },
        {
            "coautor_name": "Veronica Gil-Costa",
            "a_href": "https://scholar.google.cl/citations?user=hwXEZ0IAAAAJ&hl=es&oe=ASCII"
        },
        {
            "coautor_name": "Cesar A. Hidalgo",
            "a_href": "https://scholar.google.cl/citations?user=xhCWdtMAAAAJ&hl=es&oe=ASCII"
        },
        {
            "coautor_name": "Benjamin Piwowarski",
            "a_href": "https://scholar.google.cl/citations?user=RP4lPE8AAAAJ&hl=es&oe=ASCII"
        },
        {
            "coautor_name": "Carlos G�mez-Pantoja",
            "a_href": "https://scholar.google.cl/citations?user=SbBAYOkAAAAJ&hl=es&oe=ASCII"
        },
        {
            "coautor_name": "Benjamin Bustos",
            "a_href": "https://scholar.google.cl/citations?user=bbZWdFUAAAAJ&hl=es&oe=ASCII"
        }
    ],
    "citas_totales": "2826",
    "citas_2012": "2321",
    "indice_h_totales": "15",
    "indice_h_2012": "12",
    "indice_i10_totales": "20",
    "indice_i10_2012": "15"
}

0 个答案:

没有答案