public class DirectoryStructureToJson
extends java.lang.Object
Inspired by https://gist.github.com/shaiful16/863e05c349e34aec6851b6d9f0bc0034
Modifier and Type | Class and Description |
---|---|
static class |
DirectoryStructureToJson.Node |
Constructor and Description |
---|
DirectoryStructureToJson() |
Modifier and Type | Method and Description |
---|---|
static com.fasterxml.jackson.databind.JsonNode |
get(java.io.File base,
boolean flatten)
Turns the file system of the given directory to JSON.
|
public static com.fasterxml.jackson.databind.JsonNode get(java.io.File base, boolean flatten) throws java.io.IOException
base
- File object of the base directory.flatten
- If true, the returned JSON will be a list of files (not nested, no directories). If false, the
returned JSON will have a nested file structure.java.io.IOException