Created
July 2, 2011 18:04
-
-
Save niklasl/1061469 to your computer and use it in GitHub Desktop.
Some JSON to HTML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fpath = process.argv[2] | |
file = require('fs').readFileSync fpath, 'utf-8' | |
data = JSON.parse file | |
window = require('jsdom').jsdom(null, null).createWindow() | |
$ = require('jquery').create window | |
for key, items of data | |
dl = $("<dl id='#{key}'></dl>").appendTo $('body') | |
for num, value of items | |
dl.append "<dt>#{num}</dt><dd>#{value}</dd>" | |
require('util').print window.document.outerHTML |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment