Rewrite with JSON output