How to scan a directory to list all sub folders not files
If file_scan_directory usually returns directories then perhaps you can use the regex mask to search for names that don't have a dot (.) in them.

There are very few files in a Drupal installation that don't have an extension, and I imagine there will be none in your folder structure if all it contains is .json files...

file_scan_directory($your_root_folder, '/^[^\.]+$/');


The above should match all items in the directory structure that don't contain a dot, thanks to this answer.