Lesson 13
Inspecting JSON from Files and Logs
Opening `.json` assets, extracting JSON from mixed logs, and safe preview habits.
Real work rarely starts with a pristine .json file on disk. You copy from network panels, log lines, or error messages that wrap JSON in other text. Inspection is the skill of isolating valid text before parsing.
Dedicated JSON files
Project assets often use the extension .json:
- Package manifests (
package.json) - Locale bundles (
en.json) - Static API mocks in repositories
Open them in an editor with JSON syntax support. Validate before commit so broken files do not break builds.
JSON embedded in logs
Log lines might look like:
2026-05-22 ERROR upstream timeout body={"retry":true,"ms":3000}
Extract the {...} portion carefully—timestamps and labels are not part of JSON. Some tools highlight JSON blobs inside plain text; otherwise select from first { or [ to the matching closing bracket.
Browser and API tooling
Network tabs often offer a “JSON” view of responses. That view is formatted for display; copying may include line numbers or elide large fields. Prefer the raw response body when you need an exact reproduction.
Safe preview habits
- Do not paste production secrets into public formatters
- Redact tokens and personal data before sharing samples
- Prefer local, offline inspection for sensitive payloads
Inspection is not a separate format—it is finding the JSON boundary in messy real-world sources, then applying everything you learned about syntax and parsing.