Skip to content

Instantly share code, notes, and snippets.

@draegtun
Last active August 29, 2015 14:20
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 draegtun/d47a06a5d11370121539 to your computer and use it in GitHub Desktop.
Save draegtun/d47a06a5d11370121539 to your computer and use it in GitHub Desktop.
JSON -> CSV challenge
Rebol [
see: https://gist.github.com/jorin-vogel/2e43ffa981a97bc17259
version: 0.0.3
]
import http://reb4.me/r3/altjson
json: load-json https://gist.githubusercontent.com/jorin-vogel/7f19ce95a9a842956358/raw/e319340c2f6
file: to-file format/pad [-4 -2 -2] reduce [now/year now/month now/day ".csv"] 0
csv: open/write file
write csv join "name,creditcard" newline
remove-each rec json [none? rec/creditcard]
write/lines csv map-each rec json [ajoin [rec/name "," rec/creditcard]]
close csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment