Hey there! I've got this object with a specific structure. Here it is:
interface FolderWithContent {
uuid: string
name: string;
folders: Array<FolderWithContent>;
files: Array<Files>;
}
Just a heads up, Files is an extension of Sequelize.Model.
My goal is to return this object using hapi (
return h.response(tree).code(200);
) (tree being my object, obviously)
The issue I'm facing is that even though my object has multiple levels, the response only displays the root and first level. Let me explain with an example:
{
"name": "folder1.1",
"uuid": "1",
"folders": [
{
"name": "folder2",
"uuid": "3986b8ca-314c-4ba8-b47c-9baa29ca7adc"
},
{
"name": "folder2.6",
"uuid": "7ff93401-1281-419c-9541-fb859c4e79e1",
"folders": [
{
"name": "folder3.1",
"uuid": "8d76aa76-fa42-40c6-9c46-9fa26c6b555c"
}
],
"files": [
{
"name": "file5",
"uuid": "9a8c9aa2-23bd-45e3-bb43-ddf0e085b066"
}
]
}
],
"files": [
{
"name": "file2.2.2",
"uuid": "88519cec-b19a-4e12-9138-6273ac66ba76"
},
{
"name": "file1",
"uuid": "9eb5235d-9d04-494d-845c-4a9780bc9687"
}
]
}
In this case, I won't see the folders and files inside folder2.6. I attempted to return tree.folders[2], but it still only displayed the folder name and uuid. Surprisingly, when I returned tree.folders[2].folders, it finally showed me the folders and files within folder2.6.
I also tried calling Json.stringfy(tree), but alas, it encountered the same issue.