not all key/values converted if not in the first object
released
// from https://json-to-csv-export.vercel.app/
// bar will be in the exported csv but foo will not
// results:
// ID,First Name,Last Name,Email,Language,bar,IP Address
// 1,Sarajane,Wheatman,swheatman0@google.nl,Zulu,1234,40.98.252.240
// 2,Linell,Humpherston,lhumpherston1@google.com.br,Czech,,82.225.151.150
() => {
const mockData = [{
"ID": 1,
"First Name": "Sarajane",
"Last Name": "Wheatman",
"Email": "swheatman0@google.nl",
"Language": "Zulu",
"bar": 1234,
"IP Address": "40.98.252.240"
},
{
"ID": 2,
"foo": 4,
"First Name": "Linell",
"Last Name": "Humpherston",
"Email": "lhumpherston1@google.com.br",
"Language": "Czech",
"IP Address": "82.225.151.150"
}]
return (
<button onClick={() => jsonToCsvExport({ data: mockData })}>
Download Data
</button>
)
}
关闭于 2024-08-09 1 条评论