Debugging APIs Locally: Inspecting JWTs, Converting cURL to Fetch, and Generating TypeScript Types
Inspect production JWT tokens locally, test regular expressions, translate cURL commands to Fetch or Axios, and generate TypeScript types.
Quick summary
Pasting live bearer JWTs, API keys, or private SQL queries into unknown third-party web tools risks credential exposure in analytics or server logs. Decoding Base64URL claims, checking HMAC signatures via WebCrypto, translating cURL snippets into Fetch or Axios code, and generating TypeScript interfaces locally keeps secrets inside your browser tab.
Inspecting JWT claims and signatures without leaking bearer tokens
A JSON Web Token looks opaque at first glance, yet its header and payload segments are plain Base64URL-encoded JSON. Developers frequently paste production Authorization headers into public debugger websites to inspect scopes, tenant IDs, or expiration timestamps (exp and iat), inadvertently exposing valid session tokens to remote telemetry.
Decoding the three dot-separated segments directly inside local browser memory eliminates that risk. When you need to verify HS256, HS384, or HS512 signatures against a shared staging secret, WebCrypto performs subtle HMAC verification right on your machine without making a single network request.
From raw cURL snippets and API payloads to clean TypeScript interfaces
Turning API documentation examples into production client code typically involves three repetitive chores: adapting cURL flags into Fetch or Axios request objects, validating malformed JSON responses by exact line and column number, and modeling deeply nested JSON objects into strongly typed TypeScript interfaces.
Safe automated generators should inspect arrays of uniform objects, merge optional fields across array elements, and quote non-identifier keys such as kebab-case headers automatically while avoiding duplicate Root type aliases or silent name collisions.
| Workflow Step | Common Failure Point | Local Utility Fix |
|---|---|---|
| Parse cURL command | Mismatched single vs double quotes on -d bodies | Paired-quote shell parser emitting escaped Fetch, Axios, or HTTPie |
| Validate JSON syntax | Cryptic offset numbers on minified 50 KB payloads | Line and column error mapping with configurable indentation |
| Generate TS interfaces | Duplicate interface names overwriting nested shapes | Structural collision disambiguation and optional property detection |
| Evaluate JSONPath | Silent prototype lookup bugs like $.constructor | Strict own-property traversal with full expression consumption checks |
Checking cron schedules, regular expressions, and CSS minification edge cases
Off-by-one schedule mistakes in 5-field cron jobs, such as mixing numeric weekday ranges (1-7 vs mon-sun where Sunday represents both 0 and 7), often go unnoticed until a weekend batch job fails to trigger. Inspecting the next five actual local run timestamps before committing catches range inversion and DOM/DOW union logic immediately.
Similarly, naive string minifiers frequently corrupt valid CSS math functions by stripping required whitespace around plus and minus signs inside calc(100% + 16px) or collapsing descendant spaces before :hover pseudo-classes. Modern token-aware formatters isolate quoted strings, URLs, and CSS math functions before normalizing selectors and declarations.
Frequently asked questions
- Can browser JWT decoders verify RS256 public keys too?
- Base64URL header/payload inspection and exp claim expiration checks work on all JWT algorithms locally. Local signature verification in simple secret mode supports HS256, HS384, and HS512 via HMAC WebCrypto.
- Why do naive CSS minifiers break calc() expressions?
- Per the CSS Values specification, binary + and - operators inside calc() require whitespace on both sides to distinguish subtraction from negative lengths or percentages.
- How does cron handle day-of-month and day-of-week when both are set?
- Standard Vixie cron triggers when EITHER the day-of-month OR the day-of-week matches if both fields are restricted (not *), rather than intersecting them.
Explore category hubs
More technical guides
How to Redact, Merge, and Compress Sensitive PDFs Without Server Uploads
A practical technical guide to true browser-side PDF redaction, lossless page merging, AES-256 protection, and compression ratios without uploading files.
Documents & MediaWebP vs AVIF vs PNG vs SVG: Choosing the Right Web Image Format for Speed and Quality
Compare WebP, AVIF, PNG, JPEG, and SVG compression trade-offs, transparency support, and Core Web Vitals LCP optimization rules for fast sites.
Files & Everyday MathEncrypting Files in the Browser with AES-256-GCM, SHA-256 Checksums, and WebRTC P2P
Learn how client-side WebCrypto AES-256-GCM encryption, PBKDF2 key derivation, SHA-256 checksums, and WebRTC P2P transfers protect sensitive files.