NAME

Developer::Dashboard::JSON - JSON::XS wrapper for Developer Dashboard

SYNOPSIS

use Developer::Dashboard::JSON qw(json_encode json_decode);

DESCRIPTION

This module centralizes JSON encoding and decoding so the project uses a single consistent JSON backend and output style.

FUNCTIONS

json_encode

Encode a Perl value as canonical pretty JSON.

json_decode

Decode JSON text into a Perl value.

PURPOSE

This module centralizes JSON handling on top of JSON::XS. It provides one canonical pretty encoder and one decoder so the runtime, helper scripts, and tests all use the same backend and the same output style.

WHY IT EXISTS

It exists because the project has a hard rule to use JSON::XS and to avoid drifting JSON styles. By routing JSON encode/decode through one module, the dashboard avoids backend mismatch and keeps test fixtures and CLI output stable.

WHEN TO USE

Use this file when a feature needs JSON text, when pretty/canonical output expectations change, or when you are auditing the codebase for JSON backend drift.

HOW TO USE

Import json_encode and json_decode from this module instead of constructing JSON::XS ad hoc in feature code. Small compatibility helpers such as Developer::Dashboard::DataHelper should still route back here.

WHAT USES IT

It is used across the runtime by config, web, path, collector, skill, and helper flows, as well as by tests that assume canonical JSON output.

EXAMPLES

Example 1:

perl -Ilib -MDeveloper::Dashboard::JSON -e 1

Do a direct compile-and-load check against the module from a source checkout.

Example 2:

prove -lv t/21-refactor-coverage.t t/00-load.t

Run the focused regression tests that most directly exercise this module's behavior.

Example 3:

HARNESS_PERL_SWITCHES=-MDevel::Cover prove -lr t

Recheck the module under the repository coverage gate rather than relying on a load-only probe.

Example 4:

prove -lr t

Put any module-level change back through the entire repository suite before release.