I have got something like this
sample.jpg
photos/sample1.jpg
photos/2006/sample2.jpg
photos/2007//sample3.jpg
and I want to get this in a hierarchy in JSON object as a list if its a file then it will be only object and if it is a folder then it will be list of object again.
Basically I want this in an JSON object like this..
{
[
{
type: folder
name: photos
children: [
{
type: folder
name: 2006
children : [
{
type: file
name: sample2.jpg
}
]
}
{
type: folder
name: 2007
children : [
{
type: file
name: sample3.jpg
}
]
}
{
type : file
name : sample2.jpg
}
]
}
{
type: file
name: sample.jpg
}
]
}
Is it possible to get like this ? I'm not able to get an idea about how to do this .