Serving JSON as static file from theme or module dir

Topics: Troubleshooting, Writing themes
Mar 18, 2015 at 8:22 AM
Edited Mar 18, 2015 at 8:23 AM
I've come to a problem when trying to implement front-end HTML as a new theme in Orchard. In that sample HTML, there's a need to load .json file to display some interactive js graphic.

The json file is inside the StaticData folder. Inside it, there's already a Web.config to enable static file serving as instructed in docs. However, when loading the full layout, the .json failed to load.

After finding the solution specific to Orchard CMS, I finally found it in the more general topic of ASP .NET in sovl. In short, in root Web.config of the theme inside <configuration>, add:
        <mimeMap fileExtension=".json" mimeType="application/json" />
I hope this helps anyone suffering from the same problem.