Skip to content

Instantly share code, notes, and snippets.

@katopz
Created April 17, 2020 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save katopz/7d892411ca92b804a0e4c79cdf1d7932 to your computer and use it in GitHub Desktop.
Save katopz/7d892411ca92b804a0e4c79cdf1d7932 to your computer and use it in GitHub Desktop.
nl-kbtg-json2csv
fetch('https://covid19.th-stat.com/api/open/timeline')
.then(response => response.json())
.then(json => {
const header = Object.keys(json.Data.shift()).join(',')
const data = json.Data.map(e=>Object.values(e).join(',')).join('\n')
console.log(header + '\n' + data)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment