Tests for JSON middleware