Wrote out JSON middleware
Copied over close-open-images middleware