/** JSON syntax does not establish an application type. Keep the value unknown until decoded. */ export function parseJsonValue(text: string): unknown { return JSON.parse(text); } /** For protocols whose top-level value must be an object. Malformed JSON still throws. */ export function parseJsonRecord( text: string, ): Record | undefined { const value = parseJsonValue(text); return typeof value === "object" && value !== null && !Array.isArray(value) ? (value as Record) : undefined; }