Pass json and csv through middleware

Fixes #1493 on github
Merge pull request #1508 from steventlamb/topic/pass_json_through_middleware

Pass json and csv through middleware