add JSON export at /api.php