Fixed generating service.json file with useOutputFlatStructure.

While using this plugin to generate json files, I noticed the service.json format was not correct. This fix fixes the service.json file output, when there are subdirectories used.