kaue / jsonexport

{} → :page_facing_up: it's easy to convert JSON to CSV
http://kaue.github.io/jsonexport/
Apache License 2.0
247 stars 41 forks source link

if passed an array object, the first displayed is the last element of json #1

Closed crisryantan closed 9 years ago

crisryantan commented 9 years ago

for example I have this kind of json

    [ {
        "name"        : "reports-observation",
        "version"     : "1.0.0",
        "description" : "",
        "main"        : "server.js",
        "scripts"     : {
            "test"  : "echo \"Error: no test specified\" && exit 1",
            "start" : "node server.js"
        },
        "author"       : "",
        "license"      : "ISC",
        "dependencies" : {
            "csv"          : "^0.4.2",
            "csv-generate" : "0.0.4",
            "exceljs"      : "^0.1.11",
            "express"      : "^4.12.3",
            "fast-csv"     : "^0.6.0",
            "hapi"         : "^8.4.0",
            "should"       : "^6.0.1"
        }
    }, {
        "name"        : "reports-observation",
        "version"     : "1.0.0",
        "description" : "",
        "main"        : "server.js",
        "scripts"     : {
            "test"  : "echo \"Error: no test specified\" && exit 1",
            "start" : "node server.js"
        },
        "author"       : "",
        "license"      : "ISC",
        "dependencies" : {
            "csv"          : "^0.4.2",
            "csv-generate" : "0.0.4",
            "exceljs"      : "^0.1.11",
            "express"      : "^4.12.3",
            "fast-csv"     : "^0.6.0",
            "hapi"         : "^8.4.0",
            "should"       : "^6.0.1"
        }
    } ]

the first displayed is the "dependencies field instead of the "name" field. screenshot 2015-04-28 14 39 03

p.s. if I want this to create an xls/xlsx file how would I do that?

kaue commented 9 years ago

Hello @xxryan1234 thanks for the feedback!

Can you please try using the option orderHeaders: false?

About the XLS / XLSX currently there is no support for this extension, maybe in the future =)

crisryantan commented 9 years ago

Thanks for this! It's okay now. XLS / XLSX would surely help! Thanks