Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140817

Load JSONs recursively in node.js and typescript and parse them

$
0
0

I have the following structure

--- Folder - Sub-folder -1a.json -1b.json - Sub-folder -2a.json
- Sub-folder - more JSONS here - something.ts

I want to write a function that takes "Folder" and recursively iterate over all of it, ignoring anything that is not .json in the end (like something.ts) and return an array of all my jsons. I would later parse these jsons and create a class I wrote from them.

How can I recursively fetch all jsons and ignore other files like that? Tried using FS but I can't figure out how to fetch everything according to my demands


Viewing all articles
Browse latest Browse all 140817

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>