$res->json (Mojo::Message::Body's own JSON-decoding shortcut) — parses body as JSON on
first access. Real Mojo::Message::Body::json returns undef on a parse failure rather than
throwing (legacy code routinely checks if (defined $res->json) or wraps the whole call in
eval {} expecting exactly that); matched here by returning undefined instead of letting
JSON.parse throw.
Usage
import { type LegacyHttpResult } from "plugins/legacy-globals.d.ts";