Javascript/jQuery newbie here.
My webserver is sending the contents of a directory tree as a JSON object. The object is arbitrarily nested depending on the number of subdirectories containing other subdirectories. It looks like this:
{
"contents": [
{
"filename": "myfile",
"mtime": 123456,
"size": 2345,
"content": nil
},
{
"filename": "mydir",
"mtime": 2345678,
"size": 3456788,
"content": [
{...},
{...}
]
}
]
}
myfile is a normal file and so "content" is empty. mydir is a directory which may be empty, or contain other files or subdirectories.
I want to parse this JSON with javascript and generate an html ul representation of the contents. My question is: Is there an easy/recommended way to do this?
"content": nil-- there is nonilin JSON).