Drupal is a registered trademark of Dries Buytaert

dblog_json_viewer

2 sites No security coverage
View on drupal.org

JSON Viewer for Drupal Admin Logs

Introduction

The JSON Viewer module transforms complex, unreadable JSON data in Drupal admin log entries into an interactive, searchable, and visually organized interface. Instead of struggling with raw JSON text dumps in your watchdog logs, administrators can now explore API responses, debug information, and structured data with syntax highlighting, collapsible sections, and powerful search capabilities. This module automatically detects JSON content in dblog event details and replaces the plain text display with a modern, user-friendly JSON viewer that makes debugging and log analysis significantly more efficient.

Features

Basic Functionality:

- Automatically detects and parses JSON content within Drupal database log entries
- Replaces plain text JSON with an interactive, syntax-highlighted viewer
- Supports both Gin admin theme light and dark modes with seamless integration

Unique Features:

- Smart JSON Detection: Dynamically identifies the most relevant JSON object using complexity scoring algorithms
- Advanced Search: Real-time search with 500ms debouncing (configurable), regex support, and result navigation with Previous/Next buttons
- Interactive Navigation: Expand/collapse all sections, auto-expand when navigating search results
- Dual View Modes: Toggle between formatted JSON view and raw data view
- Copy Functionality: One-click copy for both formatted JSON and raw content
- Mobile Responsive: Fully functional on tablets and mobile devices

Use Cases:

- API Debugging: Examine API request/response data from external services
- Error Analysis: Investigate detailed error contexts and stack traces
- Development Workflow: Review complex configuration objects and data structures
- Site Monitoring: Analyze logged events with structured data payloads
- Third-party Integration: Debug webhook payloads and service communications

Post-Installation

Immediate Functionality:
Once installed and enabled, the module works automatically with no configuration required. Simply navigate to any database log entry (admin/reports/dblog/event/*) that contains JSON data, and you'll see the enhanced JSON viewer interface instead of plain text.

Configuration (Optional):
Visit Administration → Configuration → Development → Database Log JSON Viewer (`/admin/config/development/dblog-json-viewer`) to customize module settings.

How It Works:

1. Visit Administration → Reports → Recent log messages
2. Click on any log entry that contains JSON data
3. The module automatically detects and renders JSON content in the "Messages" field
4. Use the search box to find specific keys or values
5. Toggle between JSON and raw views using the interface buttons
6. Copy formatted JSON or raw content with one click

No Configuration Needed:
The module integrates seamlessly with Drupal's existing dblog system and works out-of-the-box, though optional configuration is available for advanced customization.

Additional Requirements

Core Requirements:

- Drupal 9.x, 10.x or 11.x
- Database Logging (dblog) module enabled (part of Drupal core)

JavaScript Dependencies:

- jsonview.js library (included) https://github.com/pgrabovets/json-view
- Modern browser with ES6+ support

Recommended:

- Gin admin theme for optimal visual integration (works with any admin theme)

Enhanced Experience:

- Gin Admin Theme: Provides optimal visual integration and dark mode support
- Admin Toolbar: Improves navigation to log entries

This module is unique in providing automatic JSON detection and parsing specifically for Drupal's database log system, with no equivalent functionality available in the current module ecosystem.

Community Documentation

Getting Started:

1. Install via Composer: `composer require drupal/json_viewer`
2. Enable the module: `drush en json_viewer`
3. Generate test data with APIs or error logging
4. Visit admin/reports/dblog to see the enhanced interface
5. Optionally configure settings at `/admin/config/development/dblog-json-viewer`

Activity

Total releases
3
First release
Jul 2025
Latest release
7 months ago
Release cadence
5 days
Stability
100% stable

Release Timeline

Releases

Version Type Release date
1.0.3 Stable Jul 18, 2025
1.0.2 Stable Jul 9, 2025
1.0.1 Stable Jul 9, 2025