What is expected?:
I would like to convert the below listed directory structure
into a single JSON file.
The directory structure contains JSON files
that are supposed to be included in
the output file as well.
Limitations:
Node.js
Questions:
What would be a good/efficient
way to generate the desired output,
using Node.js + Modules?
Logically, what would be the
necessary steps?
Directory structure:
CMS/
├── en/
|   ├──brand_one/
|   |  ├──footer.json
|   |  ├──header.json
|   ├──brand_two/
|   |  ├──footer.json
|   |  ├──header.json
|   ├──brand_three/
|   |  ├──footer.json
|   |  ├──header.json
├── de/
|   ├──brand_one/
|   |  ├──footer.json
|   |  ├──header.json
|   ├──brand_two/
|   |  ├──footer.json
|   |  ├──header.json
|   ├──brand_three/
|   |  ├──footer.json
|   |  ├──header.json
├── fr/
|   ├──brand_one/
|   |  ├──footer.json
|   |  ├──header.json
|   ├──brand_two/
|   |  ├──footer.json
|   |  ├──header.json
|   ├──brand_three/
|   |  ├──footer.json
|   |  ├──header.json
├── es/
|   ├──brand_one/
|   |  ├──footer.json
|   |  ├──header.json
|   ├──brand_two/
|   |  ├──footer.json
|   |  ├──header.json
|   ├──brand_three/
|   |  ├──footer.json
|   |  ├──header.json
[...]
Desired output:
// content.json
{
  "en":[
    {
      "brand_one":{
        "footer":{
          "val": "value",
          [...]
        },
        "header":{
          "val": "value",
          [...]
        }
      },
      "brand_two":{
        "footer":{
          "val": "value",
          [...]
        },
        "header":{
          "val": "value",
          [...]
        }
      },
      "brand_three":{
        "footer":{
          "val": "value",
          [...]
        },
        "header":{
          "val": "value",
          [...]
        }
      }
    }
  ],
  [...]
}
 
     
    