Skip to content

Instantly share code, notes, and snippets.

@ataylor284
Last active December 20, 2015 17:09
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 ataylor284/6166214 to your computer and use it in GitHub Desktop.
Save ataylor284/6166214 to your computer and use it in GitHub Desktop.
def makeContent(file) {
if (file.directory) {
[ file: file.name, type: 'dir', contents: file.listFiles().collect { makeContent(it) } ]
} else {
[ file: file.name, type: 'file' ]
}
}
def map = makeContent(new File( 'conf' ))
println new groovy.json.JsonBuilder( map ).toPrettyString()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment